benilla-re systems structs docs

luaL_unref

function · lua · boundary

Address
0x6f5400 · 143 bytes, up to 0x6f548e
Meaning
Releases a reference made by luaL_ref into the free list of the table
Confidence
verified, proof one
Finding
lua/auxlib#table-sizes-and-references

Finding: Table sizes and references in lua: the auxiliary library

luaL_getn and luaL_setn keep the length of a table. A table with an n field uses it. Else the length is held in a weak-key table at registry reference 2 (getsizes), keyed by the table, and luaL_getn counts upward from index 1 when neither exists. checkint reads an integer and answers -1 for a non-number. luaL_ref stores the top value in a table and returns a number for it, reusing freed numbers from slot 1; luaL_unref returns one.

functionnamedecided by
0x6f4ea0luaL_setnlua_rawget of n (0x6f4ed1), checkint (0x6f4edd), getsizes (0x6f4f2f), lua_rawset (0x6f4f54)
0x6f4f80checkintlua_tonumber, __ftol (0x6f4f8f), lua_isnumber (0x6f4f9f), -1 (0x6f4fa8), lua_settop (0x6f4fb2)
0x6f4fc0getsizeslua_rawgeti 2 (0x6f4fca), the __mode field k (0x6f5008), lua_rawseti (0x6f5041)
0x6f5050luaL_getnlua_rawget of n (0x6f507d), getsizes (0x6f5098), lua_rawgeti probe loop (0x6f50cd)
0x6f5310luaL_refnil returns -1 (0x6f534a), free list at slot 1 (push 1 at 0x6f536e, read 0x6f5374), else luaL_getn (0x6f53b1) at least 2, plus 1, so the first number is 3 (0x6f53b8)
0x6f5400luaL_unrefa negative reference returns at once (0x6f5410); slot 1 read (0x6f5444, 0x6f544a), relinked (0x6f5454, 0x6f5469, 0x6f546f)

The derivation is in the doc.

Callers 8

Callees 4

Calls and jumps by a bare address, from tables/calls.tsv.