| 800 | } |
| 801 | |
| 802 | static int dfhack_pen_index(lua_State *L) |
| 803 | { |
| 804 | lua_settop(L, 2); |
| 805 | luaL_checktype(L, 1, LUA_TUSERDATA); |
| 806 | |
| 807 | // check metatable |
| 808 | if (!lua_getmetatable(L, 1)) |
| 809 | luaL_argerror(L, 1, "must be a pen"); |
| 810 | lua_pushvalue(L, 2); |
| 811 | lua_rawget(L, -2); |
| 812 | if (!lua_isnil(L, -1)) |
| 813 | return 1; |
| 814 | |
| 815 | // otherwise read from the mirror table, creating it if necessary |
| 816 | lua_settop(L, 2); |
| 817 | get_pen_mirror(L, 1); |
| 818 | lua_pushvalue(L, 2); |
| 819 | lua_rawget(L, -2); |
| 820 | return 1; |
| 821 | } |
| 822 | |
| 823 | static int pen_pnext(lua_State *L) |
| 824 | { |
nothing calls this directly
no test coverage detected