benilla-re systems structs docs

lua_getfenv

function · lua · boundary

Address
0x6f3d50 · 196 bytes, up to 0x6f3e13
Meaning
Pushes the environment of a Lua function, the globals for any other value
Confidence
verified, proof one
Finding
lua/api#tables-and-metatables

Finding: Tables and metatables in lua: the C API

Twelve functions read and write tables. lua_gettable and lua_settable go through metamethods (luaV_gettable, luaV_settable), lua_rawget, lua_rawgeti, lua_rawset and lua_rawseti do not. lua_getmetatable and lua_setmetatable read and write the metatable of a table or full userdata, and lua_getfenv and lua_setfenv the environment of a Lua function. lua_next steps a traversal and lua_concat joins the top n values. The default metatable [G+0x48] reads as no metatable.

functionnamedecided by
0x6f3a40lua_gettablecalls luaV_gettable with loop 0 (0x6f3ab3)
0x6f3b00lua_rawgetcalls luaH_get (0x6f3b6f), copies the result over the key
0x6f3bc0lua_rawgeticalls luaH_getnum (0x6f3c30), top raised by 16 (0x6f3c6a)
0x6f3cf0lua_getmetatabletag 5 or 7 (0x6f3cfe, 0x6f3d03), result compared with [G+0x48], tag 5 pushed (0x6f3d37)
0x6f3d50lua_getfenvtag 6 and the C byte (0x6f3db5), closure+0x10 (0x6f3dc4), else L+0x40
0x6f3e20lua_settablecalls luaV_settable on top-0x20 (0x6f3e94), pops two (0x6f3e99)
0x6f3ea0lua_rawsetcalls luaH_set on top-0x20 (0x6f3f17), pops two
0x6f3f60lua_rawseticalls luaH_setnum (0x6f3fd8), pops one, ret 4
0x6f4020lua_setmetatablenil becomes G+0x40 (0x6f4099), tags 5 and 7 (0x6f409e, 0x6f40a3), pointer stored at +8 of the object
0x6f40d0lua_setfenvtag 6 and the C byte (0x6f413f), 16 bytes stored at closure+0x10
0x6f4450lua_nextcalls luaH_next (0x6f44c1), top raised on a result, lowered at the end
0x6f44e0lua_concatn >= 2 calls luaV_concat (0x6f450c); n == 0 interns the empty string (0x6f4542)

The derivation is in the doc.

Callers 1

Callees 0

None by a direct call or jump.

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