Enable the global Lua state when loading scheduled scripts from file

This commit is contained in:
Erik Broberg
2016-08-30 14:01:42 -04:00
parent 8c137a78b2
commit 5e31638b92
2 changed files with 4 additions and 4 deletions

View File

@@ -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);

View File

@@ -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) {