summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/test_LLAppearance.lua
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-08-28 16:47:38 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-08-28 16:47:38 -0400
commit14c8fc3768d978205bf17ffc1905c2772afbd434 (patch)
treefea42d23fa6b9b11eb4be1e2dcefe81eed5e49aa /indra/newview/scripts/lua/test_LLAppearance.lua
parent841e19c1cb62341c10254e6f4bf992c0c19d27b8 (diff)
Add `LL.setdtor()` function to add a "destructor" to any Lua object.
`setdtor('description', object, function)` returns a proxy userdata object referencing object and function. When the proxy is garbage-collected, or at the end of the script, its destructor calls `function(object)`. The original object may be retrieved as `proxy._target`, e.g. to pass it to the `table` library. The proxy also has a metatable with metamethods supporting arithmetic operations, string concatenation, length and table indexing. For other operations, retrieve `proxy._target`. (But don't assign to `proxy._target`. It will appear to work, in that subsequent references to `proxy._target` will retrieve the replacement object -- however, the destructor will still call `function(original object)`.) Fix bugs in `lua_setfieldv()`, `lua_rawgetfield()` and `lua_rawsetfield()`. Add C++ functions `lua_destroyuserdata()` to explicitly destroy a `lua_emplace<T>()` userdata object, plus `lua_destroybounduserdata()`. The latter can bind such a userdata object as an upvalue to pass to `LL.atexit()`. Make `LL.help()` and `LL.leaphelp()` help text include the `LL.` prefix.
Diffstat (limited to 'indra/newview/scripts/lua/test_LLAppearance.lua')
0 files changed, 0 insertions, 0 deletions