* Initialize access to DF objects from the interpreter * context, unless it has already been done. */
| 1848 | * context, unless it has already been done. |
| 1849 | */ |
| 1850 | void LuaWrapper::AttachDFGlobals(lua_State *state) |
| 1851 | { |
| 1852 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPETABLE_TOKEN); |
| 1853 | |
| 1854 | if (lua_isnil(state, -1)) |
| 1855 | { |
| 1856 | lua_pop(state, 1); |
| 1857 | lua_newtable(state); |
| 1858 | lua_dup(state); |
| 1859 | lua_rawsetp(state, LUA_REGISTRYINDEX, &DFHACK_TYPETABLE_TOKEN); |
| 1860 | |
| 1861 | luaL_requiref(state, "df", DoAttach, 1); |
| 1862 | lua_pop(state, 1); |
| 1863 | } |
| 1864 | |
| 1865 | lua_pop(state, 1); |
| 1866 | } |
| 1867 | |
| 1868 | namespace DFHack { namespace LuaWrapper { |
| 1869 | struct LuaToken { int reserved; }; |
nothing calls this directly
no test coverage detected