来源:lua
浏览 357
扫码
分享
2020-04-25 13:28:39
7.2 – Changes in the Libraries
- Function
string.gfind
was renamed string.gmatch
. (See compile-time option LUA_COMPAT_GFIND
in luaconf.h
.) - When
string.gsub
is called with a function as its third argument, whenever this function returns nil or false the replacement string is the whole match, instead of the empty string. - Function
table.setn
was deprecated. Function table.getn
corresponds to the new length operator (#
); use the operator instead of the function. (See compile-time option LUA_COMPAT_GETN
in luaconf.h
.) - Function
loadlib
was renamed package.loadlib
. (See compile-time option LUA_COMPAT_LOADLIB
in luaconf.h
.) - Function
math.mod
was renamed math.fmod
. (See compile-time option LUA_COMPAT_MOD
in luaconf.h
.) - Functions
table.foreach
and table.foreachi
are deprecated. You can use a for loop with pairs
or ipairs
instead. - There were substantial changes in function
require
due to the new module system. However, the new behavior is mostly compatible with the old, but require
gets the path from package.path
instead of from LUA_PATH
. - Function
collectgarbage
has different arguments. Function gcinfo
is deprecated; use collectgarbage("count")
instead.
当前内容版权归
lua 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问
lua .