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

Method Require

library/LuaTools.cpp:1061–1077  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1059}
1060
1061bool DFHack::Lua::Require(color_ostream &out, lua_State *state,
1062 const std::string &module, bool setglobal)
1063{
1064 if (!PushModule(out, state, module.c_str()))
1065 return false;
1066
1067 if (setglobal)
1068 {
1069 lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_BASE_G_TOKEN);
1070 lua_swap(state);
1071 lua_setfield(state, -2, module.c_str());
1072 }
1073 else
1074 lua_pop(state, 1);
1075
1076 return true;
1077}
1078
1079static bool doAssignDFObject(color_ostream *out, lua_State *state,
1080 const type_identity *type, void *target, int val_index,

Callers

nothing calls this directly

Calls 5

PushModuleFunction · 0.85
lua_rawgetpFunction · 0.85
lua_swapFunction · 0.85
lua_setfieldFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected