Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

lua_setuservalue

Philipp Janda edited this page Mar 9, 2015 · 2 revisions

lua_setuservalue

In Lua 5.2 you can set the uservalue of a userdata to nil or to a table. Lua 5.1 only allows tables as environments for userdata, and the usual default values for a userdata's environment is the globals table _G, or the package table. Therefore, the compatibility implementation of lua_getuservalue treats _G and package environments as nil uservalues. The compatiblitiy implementation of lua_setuservalue does the same and sets the environment of a userdata to _G if you try to set the uservalue to nil.

Clone this wiki locally