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

Method PushFunctionWrapper

library/LuaTypes.cpp:1282–1293  ·  view source on GitHub ↗

* Push a closure invoking the given function. */

Source from the content-addressed store, hash-verified

1280 * Push a closure invoking the given function.
1281 */
1282void LuaWrapper::PushFunctionWrapper(lua_State *state, int meta_idx,
1283 const char *name, function_identity_base *fun)
1284{
1285 lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPETABLE_TOKEN);
1286 if (meta_idx)
1287 lua_pushvalue(state, meta_idx);
1288 else
1289 lua_pushlightuserdata(state, NULL); // can't be a metatable
1290 lua_pushfstring(state, "%s()", name);
1291 lua_pushlightuserdata(state, fun);
1292 lua_pushcclosure(state, meta_call_function, 4);
1293}
1294
1295/**
1296 * Create a closure invoking the given function, and add it to the field table.

Callers

nothing calls this directly

Calls 5

lua_rawgetpFunction · 0.85
lua_pushvalueFunction · 0.85
lua_pushlightuserdataFunction · 0.85
lua_pushfstringFunction · 0.85
lua_pushcclosureFunction · 0.85

Tested by

no test coverage detected