且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Lua 5.2中使用“module”函数?

更新时间:2023-02-21 09:35:54

p>您可能需要使用LUA_COMPAT_MODULE编译您的Lua实例;根据源代码:LUA_COMPAT_MODULE控制与以前的模块功能模块(Lua)和'luaL_register'(C)的兼容性。

You may need to compile your Lua instance with LUA_COMPAT_MODULE; according to the source code: "LUA_COMPAT_MODULE controls compatibility with previous module functions 'module' (Lua) and 'luaL_register' (C)".

这将不够虽然模块本身是用Lua 5.1 API编写的。您可以尝试找到其Lua 5.2版本,或使用像Peter Cawley的 TwoFace 允许Lua 5.2程序加载大多数5.1 C库而不需要任何重新编译。

This won't be enough though as the module itself is written with Lua 5.1 API in mind. You can either try to find its Lua 5.2 version or use something like Peter Cawley's TwoFace that "allows a Lua 5.2 program to load most 5.1 C libraries without the need for any recompilation".