* Add a __pairs/__ipairs metamethod using iterator on the top of stack. */
| 1224 | * Add a __pairs/__ipairs metamethod using iterator on the top of stack. |
| 1225 | */ |
| 1226 | void LuaWrapper::SetPairsMethod(lua_State *state, int meta_idx, const char *name) |
| 1227 | { |
| 1228 | if (lua_isnil(state, -1)) |
| 1229 | { |
| 1230 | lua_pop(state, 1); |
| 1231 | lua_pushcfunction(state, meta_nodata); |
| 1232 | } |
| 1233 | |
| 1234 | lua_pushcclosure(state, meta_pairs, 1); |
| 1235 | lua_setfield(state, meta_idx, name); |
| 1236 | } |
| 1237 | |
| 1238 | /** |
| 1239 | * Add a struct-style (3 upvalues) metamethod to the metatable. |
nothing calls this directly
no test coverage detected