benilla-re systems structs docs

lua_tocfunction

function · lua · unreached

Address
0x6f3720 · 31 bytes, up to 0x6f373e
Meaning
Returns the C function of a C closure, else null
Confidence
verified, proof two
Finding
lua/api#reading-values

Finding: Reading values in lua: the C API

Six functions read a value out of its slot. lua_toboolean answers 0 for nil and false and 1 for anything else, lua_strlen the length of a string or of a number converted to one, lua_tocfunction the C function of a C closure, lua_touserdata the block of a full userdata or the pointer of a light one, lua_tothread the state of a thread, and lua_topointer a pointer for a userdata, table, function or thread. A slot that does not fit answers 0.

functionnamedecided by
0x6f3660lua_tobooleantag 0 and tag 1 with payload 0 answer 0 (0x6f366b, 0x6f366f, 0x6f3677)
0x6f36e0lua_strlenstring length at [str+0xc] (0x6f36f7), luaV_tostring first for a number (0x6f3701)
0x6f3720lua_tocfunctiontag 6 at 0x6f3729, C byte at closure+6, function at closure+0xc
0x6f3740lua_touserdatatag 2 returns the payload, tag 7 returns the payload plus 16 (0x6f375c)
0x6f3770lua_tothreadtag 8 at 0x6f3779, payload returned
0x6f3790lua_topointerjump table at 0x6f37a9 on tag minus 2; userdata tags jump to 0x6f3740 (0x6f37bc), tags 5, 6 and 8 return the payload

The derivation is in the doc.

Callers 0

None by a direct call or jump.

Callees 1

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