Skip to content

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

@woct0rdho

Description

@woct0rdho

我们目前使用的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时报错,而会在运行时报变量没有定义的错

由于ToLua# native plugin的跨平台编译还没完全搞定,macOS上load的行为会与Windows上不同。如果出现报错bad argument #1 to 'load' (function expected, got string),可以试试把load换成loadstring(更新:现在所有平台用的都是LuaJIT,应该没有这个问题了)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions