Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于Lua的杂七杂八的问题(不定期更新) #5

Open
woct0rdho opened this issue Jun 16, 2021 · 1 comment
Open

关于Lua的杂七杂八的问题(不定期更新) #5

woct0rdho opened this issue Jun 16, 2021 · 1 comment

Comments

@woct0rdho
Copy link
Collaborator

woct0rdho commented Jun 16, 2021

我们目前使用的Lua运行库为ToLua#,它使用的Lua语言版本为LuaJIT,与Lua 5.1完全兼容,Lua 5.2的特性只有一部分兼容

built_in.lua开头的地方禁止了读取没有定义的全局变量,会报错Attempt to read undeclared global variable

我们的Lua parser支持Unicode字符。比如你把字符串'abc'外面的英文引号打错成了中文引号‘abc’,parser就会把它当成一个叫做‘abc’的变量,不会在parsing时报错,而会在运行时报变量没有定义的错

macOS上load的行为似乎与Windows上不同。如果出现报错bad argument #1 to 'load' (function expected, got string),可以试试把load换成loadstring

目前preload系统使用正则表达式来识别show之类的函数,具体可以看DialogueEntryPreprocessor.cs。函数的参数如果是字符串,必须用单引号或者双引号(而不是方括号)来表示,否则无法识别

@nekomeowww
Copy link

nekomeowww commented Jun 17, 2021

补充:macOS 运行报错,可以试试把 Assets/Nova/Lua/script_loader.lua 第 71 行的 load改为 loadstring
对应代码:https://github.com/Lunatic-Works/Nova/blob/master/Assets/Nova/Lua/script_loader.lua#L71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants