Lua/Porting notes

This page shows some migration notes between major versions of Lua.

Functions and structures declared as deprecated can be used with USE-flag "deprecated" on specific Lua major release (5.1, 5.2 etc), but next release usually completely remove deprecated code. Avoid using the "deprecated" flag and try to migrate to the new API.

luaL_getn / luaL_setn
Compatibility define in luaconf.h: LUA_COMPAT_GETN

Replace  with  :

completely dropped, is safe to remove it from code.

lua_open
Replace  with  :

luaL_openlib
Compatibility define in luaconf.h: LUA_COMPAT_OPENLIB

Lua manual says that this function should be replaced with, which is deprecated in Lua 5.2 too. For universal approach it's better "backport"  and use it as substitution for   and  :

Calls to  and   should be changed according to its second argument. If second argument is NULL, migration is simple:

Calls such as  and   should be carefully rewritten because a global table with the given name will be searched and possibly created. When possible, it should be rewritten to.

lua_strlen / lua_objlen
Replace them with :

lua_equal / lua_lessthan
Replace them with appropriate  calling:

luaL_register
Compatibility define in luaconf.h: LUA_COMPAT_MODULE

See

External resources

 * Lua 5 Migration Guide