来源:lua
浏览 477
扫码
分享
2020-04-25 13:33:38
8.2 – Changes in the Libraries
- Function
module
is deprecated. It is easy to set up a module with regular Lua code. Modules are not expected to set global variables. - Functions
setfenv
and getfenv
were removed, because of the changes in environments. - Function
math.log10
is deprecated. Use math.log
with 10 as its second argument, instead. - Function
loadstring
is deprecated. Use load
instead; it now accepts string arguments and are exactly equivalent to loadstring
. - Function
table.maxn
is deprecated. Write it in Lua if you really need it. - Function
os.execute
now returns true when command terminates successfully and nil plus error information otherwise. - Function
unpack
was moved into the table library and therefore must be called as table.unpack
. - Character class
%z
in patterns is deprecated, as now patterns may contain ‘\0
‘ as a regular character. - The table
package.loaders
was renamed package.searchers
. - Lua does not have bytecode verification anymore. So, all functions that load code (
load
and loadfile
) are potentially insecure when loading untrusted binary data. (Actually, those functions were already insecure because of flaws in the verification algorithm.) When in doubt, use the mode
argument of those functions to restrict them to loading textual chunks. - The standard paths in the official distribution may change between versions.
当前内容版权归
lua 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问
lua .