* Add a 6 upvalue metamethod to the metatable. */
| 1261 | * Add a 6 upvalue metamethod to the metatable. |
| 1262 | */ |
| 1263 | void LuaWrapper::PushContainerMethod(lua_State *state, int meta_idx, int ftable_idx, |
| 1264 | lua_CFunction function, |
| 1265 | const type_identity *container, const type_identity *item, int count) |
| 1266 | { |
| 1267 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPETABLE_TOKEN); |
| 1268 | lua_pushvalue(state, meta_idx); |
| 1269 | lua_pushvalue(state, ftable_idx); |
| 1270 | |
| 1271 | lua_pushlightuserdata(state, const_cast<type_identity*>(container)); |
| 1272 | lua_pushlightuserdata(state, const_cast<type_identity*>(item)); |
| 1273 | if (count < 0) |
| 1274 | lua_pushnil(state); |
| 1275 | else |
| 1276 | lua_pushinteger(state, count); |
| 1277 | |
| 1278 | lua_pushcclosure(state, function, 6); |
| 1279 | } |
| 1280 | |
| 1281 | /** |
| 1282 | * Add a 6 upvalue metamethod to the metatable. |
nothing calls this directly
no test coverage detected