MCPcopy Create free account
hub / github.com/DFHack/dfhack / treatstackoption

Function treatstackoption

depends/lua/src/ldblib.c:130–136  ·  view source on GitHub ↗

** In function 'db_getinfo', the call to 'lua_getinfo' may push ** results on the stack; later it creates the result table to put ** these objects. Function 'treatstackoption' puts the result from ** 'lua_getinfo' on top of the result table so that it can call ** 'lua_setfield'. */

Source from the content-addressed store, hash-verified

128** 'lua_setfield'.
129*/
130static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) {
131 if (L == L1)
132 lua_rotate(L, -2, 1); /* exchange object and table */
133 else
134 lua_xmove(L1, L, 1); /* move object to the "main" stack */
135 lua_setfield(L, -2, fname); /* put object into table */
136}
137
138
139/*

Callers 1

db_getinfoFunction · 0.85

Calls 3

lua_rotateFunction · 0.85
lua_xmoveFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected