lua_setfenv
function · lua · boundary
- Address
0x6f40d0· 163 bytes, up to0x6f4172- Meaning
- Pops a table into the environment of the Lua function at an index, returning 0 for other values
- 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.
| function | name | decided by |
|---|---|---|
0x6f3a40 | lua_gettable | calls luaV_gettable with loop 0 (0x6f3ab3) |
0x6f3b00 | lua_rawget | calls luaH_get (0x6f3b6f), copies the result over the key |
0x6f3bc0 | lua_rawgeti | calls luaH_getnum (0x6f3c30), top raised by 16 (0x6f3c6a) |
0x6f3cf0 | lua_getmetatable | tag 5 or 7 (0x6f3cfe, 0x6f3d03), result compared with [G+0x48], tag 5 pushed (0x6f3d37) |
0x6f3d50 | lua_getfenv | tag 6 and the C byte (0x6f3db5), closure+0x10 (0x6f3dc4), else L+0x40 |
0x6f3e20 | lua_settable | calls luaV_settable on top-0x20 (0x6f3e94), pops two (0x6f3e99) |
0x6f3ea0 | lua_rawset | calls luaH_set on top-0x20 (0x6f3f17), pops two |
0x6f3f60 | lua_rawseti | calls luaH_setnum (0x6f3fd8), pops one, ret 4 |
0x6f4020 | lua_setmetatable | nil becomes G+0x40 (0x6f4099), tags 5 and 7 (0x6f409e, 0x6f40a3), pointer stored at +8 of the object |
0x6f40d0 | lua_setfenv | tag 6 and the C byte (0x6f413f), 16 bytes stored at closure+0x10 |
0x6f4450 | lua_next | calls luaH_next (0x6f44c1), top raised on a result, lowered at the end |
0x6f44e0 | lua_concat | n >= 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.