* Push a closure invoking the given function. */
| 1280 | * Push a closure invoking the given function. |
| 1281 | */ |
| 1282 | void 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. |
nothing calls this directly
no test coverage detected