You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
Philipp Janda edited this page Mar 11, 2015
·
3 revisions
lua_getuservalue
In Lua 5.1 all userdata have tables as environments. If you don't set
an environment explicitly, one is inherited by the function that
created the userdata (this is the global table _G for newproxy,
and the package table for userdata created in C modules loaded via
require). Also, you can only replace the environment of a userdata
with another table.
In Lua 5.2 on the other hand, userdata start with nil as the initial
uservalue. You can set the uservalue to a table and back to nil.
To emulate the behavior of Lua 5.2 the compatibility implementation of
lua_getuservalue pushes nil onto the Lua stack whenever the
userdata has an environment equal to _G or the package table, and
the actual environment table otherwise.