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

debug.setuservalue

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

debug.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 implementataion of debug.getuservalue translates _G and package environments to nil uservalues. The compatibility implementation of debug.setuservalue does the same and sets the environment of a userdata to _G if you try to set the uservalue to nil. See also lua_setuservalue.

Clone this wiki locally