luaL_getn
function · lua · boundary
- Address
0x6f5050· 200 bytes, up to0x6f5117- Meaning
- Returns the length of a table from its n field, the size table, or by counting
- 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.
| function | name | decided by |
|---|---|---|
0x6f4ea0 | luaL_setn | lua_rawget of n (0x6f4ed1), checkint (0x6f4edd), getsizes (0x6f4f2f), lua_rawset (0x6f4f54) |
0x6f4f80 | checkint | lua_tonumber, __ftol (0x6f4f8f), lua_isnumber (0x6f4f9f), -1 (0x6f4fa8), lua_settop (0x6f4fb2) |
0x6f4fc0 | getsizes | lua_rawgeti 2 (0x6f4fca), the __mode field k (0x6f5008), lua_rawseti (0x6f5041) |
0x6f5050 | luaL_getn | lua_rawget of n (0x6f507d), getsizes (0x6f5098), lua_rawgeti probe loop (0x6f50cd) |
0x6f5310 | luaL_ref | nil 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) |
0x6f5400 | luaL_unref | a negative reference returns at once (0x6f5410); slot 1 read (0x6f5444, 0x6f544a), relinked (0x6f5454, 0x6f5469, 0x6f546f) |
The derivation is in the doc.
Callers 8
- luaL_ref lua
- ScriptUnpack ui
- luaB_foreachi lua
- luaB_getn lua
- luaB_tinsert lua
- luaB_tremove lua
- str_concat lua
- luaB_sort lua
Callees 9
- lua_gettop lua
- lua_settop lua
- lua_pushvalue lua
- lua_type lua
- lua_pushlstring lua
- lua_rawget lua
- lua_rawgeti lua
- checkint lua
- getsizes lua
Calls and jumps by a bare address, from tables/calls.tsv.