MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / Init

Method Init

TombEngine/Scripting/Internal/ScriptInterfaceState.cpp:88–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88void ScriptInterfaceState::Init(const std::string& assetsDir)
89{
90 SolState.open_libraries(
91 sol::lib::base, sol::lib::math, sol::lib::package, sol::lib::coroutine,
92 sol::lib::table, sol::lib::string, sol::lib::debug);
93
94 SolState.script("package.path=\"" + assetsDir + "Scripts/?.lua\"");
95 SolState.set_exception_handler(lua_exception_handler);
96 lua_sethook(SolState, lua_deadlock_handler, LUA_MASKCOUNT, DEADLOCK_HOOK_INSTRUCTION_COUNT);
97
98 RootTable = sol::table(SolState.lua_state(), sol::create);
99 SolState.set(ScriptReserved_TEN, RootTable);
100
101 // Misc. handlers not assigned above.
102 TEN::Scripting::InventoryHandler::Register(&SolState, RootTable);
103 TEN::Scripting::Collision::Register(&SolState, RootTable);
104 TEN::Scripting::Effects::Register(&SolState, RootTable);
105 TEN::Scripting::Input::Register(&SolState, RootTable);
106 TEN::Scripting::Sound::Register(&SolState, RootTable);
107 TEN::Scripting::Util::Register(&SolState, RootTable);
108 TEN::Scripting::View::Register(&SolState, RootTable);
109}

Callers

nothing calls this directly

Calls 6

open_librariesMethod · 0.80
scriptMethod · 0.80
set_exception_handlerMethod · 0.80
RegisterFunction · 0.50
lua_stateMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected