mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-22 12:59:07 -06:00
Enable the global Lua state when loading scheduled scripts from file
This commit is contained in:
@@ -58,7 +58,7 @@ struct ScheduledScript {
|
||||
class ScriptScheduler {
|
||||
public:
|
||||
|
||||
void loadScripts(const std::string& filename);
|
||||
void loadScripts(const std::string& filename, lua_State* L = nullptr);
|
||||
void loadScripts(const ghoul::Dictionary& dict);
|
||||
|
||||
void skipTo(double time);
|
||||
|
||||
@@ -63,10 +63,10 @@ ScheduledScript::ScheduledScript(const ghoul::Dictionary& dict)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptScheduler::loadScripts(const std::string& filepath) {
|
||||
void ScriptScheduler::loadScripts(const std::string& filepath, lua_State* L) {
|
||||
ghoul::Dictionary timedScriptsDict;
|
||||
try {
|
||||
ghoul::lua::loadDictionaryFromFile(absPath(filepath), timedScriptsDict);
|
||||
ghoul::lua::loadDictionaryFromFile(absPath(filepath), timedScriptsDict, L);
|
||||
}
|
||||
catch (const ghoul::RuntimeError& e) {
|
||||
LERROR(e.what());
|
||||
@@ -145,7 +145,7 @@ namespace luascriptfunctions {
|
||||
return luaL_error(L, "filepath string is empty");
|
||||
}
|
||||
|
||||
OsEng.scriptScheduler().loadScripts(missionFileName);
|
||||
OsEng.scriptScheduler().loadScripts(missionFileName, L);
|
||||
}
|
||||
|
||||
int skipTo(lua_State* L) {
|
||||
|
||||
Reference in New Issue
Block a user