8.3 – Changes in the API

  • Pseudoindex LUA_GLOBALSINDEX was removed. You must get the global environment from the registry (see §4.5).
  • Pseudoindex LUA_ENVIRONINDEX and functions lua_getfenv/lua_setfenv were removed, as C functions no longer have environments.
  • Function luaL_register is deprecated. Use luaL_setfuncs so that your module does not create globals. (Modules are not expected to set global variables anymore.)
  • The osize argument to the allocation function may not be zero when creating a new block, that is, when ptr is NULL (see lua_Alloc). Use only the test ptr == NULL to check whether the block is new.
  • Finalizers (__gc metamethods) for userdata are called in the reverse order that they were marked for finalization, not that they were created (see §2.5.1). (Most userdata are marked immediately after they are created.) Moreover, if the metatable does not have a __gc field when set, the finalizer will not be called, even if it is set later.
  • luaL_typerror was removed. Write your own version if you need it.
  • Function lua_cpcall is deprecated. You can simply push the function with lua_pushcfunction and call it with lua_pcall.
  • Functions lua_equal and lua_lessthan are deprecated. Use the new lua_compare with appropriate options instead.
  • Function lua_objlen was renamed lua_rawlen.
  • Function lua_load has an extra parameter, mode. Pass NULL to simulate the old behavior.
  • Function lua_resume has an extra parameter, from. Pass NULL or the thread doing the call.