简体   繁体   English

在Luaj中定义Lua模块是否支持模块功能?

[英]Is it supported module function to define Lua module in Luaj?

In my lua script, it requires another lua module by following statement: 在我的lua脚本中,它需要通过以下语句来使用另一个lua模块:

require 'another' 需要“另一个”

In my another lua module, the first line of code is: 在我的另一个lua模块中,第一行代码是:

module(..., ) 模块(...,)

However, it looks like that Luaj does not has 'module' function defined or not support it at all in the returned global object. 但是,看起来Luaj没有在返回的全局对象中定义或完全不支持“模块”功能。 I am using luaj 3.0 belter 2. Does it support the module function in luaj? 我正在使用luaj 3.0 Belter2。它是否支持luaj中的模块功能? If so, how to use it? 如果可以,该如何使用?

Thanks in advance! 提前致谢!

I examined source codes of Luaj 3.0. 我检查了Luaj 3.0的源代码。 The 'module' function seems to be not supported in Luaj 3.0. Luaj 3.0中似乎不支持“模块”功能。 You'd better to use Luaj 2.0.3. 您最好使用Luaj 2.0.3。

There is no more 'module' function in Lua 5.2. Lua 5.2中没有更多的“模块”功能。 Since Luaj 3.0 supports Lua 5.2 only, this is why 'module' function not available any more. 由于Luaj 3.0仅支持Lua 5.2,因此这就是“模块”功能不再可用的原因。 In Lua 5.2, there are updates for handling Lua module. 在Lua 5.2中,有用于处理Lua模块的更新。 The old module functionality in Lua 5.1 has big issue in security and it was discard in Lua 5.2. Lua 5.1中的旧模块功能在安全性方面存在重大问题,在Lua 5.2中已被废弃。 However, to support old Lua program which is using the old way of Lua module functionality, Luaj 2.0.3 has to be used. 但是,要支持使用Lua模块功能的旧方法的旧Lua程序,必须使用Luaj 2.0.3。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM