MCPcopy Create free account
hub / github.com/DFHack/dfhack / AttachDFGlobals

Method AttachDFGlobals

library/LuaWrapper.cpp:1850–1866  ·  view source on GitHub ↗

* Initialize access to DF objects from the interpreter * context, unless it has already been done. */

Source from the content-addressed store, hash-verified

1848 * context, unless it has already been done.
1849 */
1850void 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
1868namespace DFHack { namespace LuaWrapper {
1869 struct LuaToken { int reserved; };

Callers

nothing calls this directly

Calls 4

lua_rawgetpFunction · 0.85
lua_dupFunction · 0.85
lua_rawsetpFunction · 0.85
luaL_requirefFunction · 0.85

Tested by

no test coverage detected