LuaJIT / script loading failed with long function name

我有一些在 C++ 中运行无误的 Lua 脚本。

我想要变为使用 LuaJIT 2.0.5。

在加载脚本时我发现了一个非常奇怪的错误。

它似乎取决于函数名称的长度。

请看下面的内容:

[测试环境]

- Visual Studio 2015 on windowns 10(C++)

- LuaJIT 2.0.5 由 VS2015 编译

- 脚本构建命令:luajit.exe -b util.lua util.lua.luajit

- sol v2.20.2 (revision d67c5b7)(https://sol2.readthedocs.io/en/latest/)库

- sol 代码:https://github.com/ThePhD/sol2

[问题]

是否存在变量长度限制或函数名称?

这个脚本在 Lua 5.3.4 中运行良好

唯一的1个不同是函数名称的长度。

-- 失败
function check_inventory_craft(goal_tabl, my_record_table, playerobject)
end
-- 错误信息:[sol2] An error occurred and has been passed to an error handler: sol: syntax error: (binary): cannot load malformed bytecode

-- 成功
function check_inventorycraft(goal_tabl, my_record_table, playerobject)
end
点赞