From 5f98ec2ca9ec690ef32cdf27392ce03feec33e6a Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 7 Feb 2017 17:02:43 -0500 Subject: [PATCH] Update Ghoul repository Make changes to accommodate the new Lua state class --- ext/ghoul | 2 +- src/engine/openspaceengine.cpp | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index a3b333ba99..bf38f9131c 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit a3b333ba997758c3bd9022fb431c322fbdc5945c +Subproject commit bf38f9131cce7d0ca85551728e223431dd95b9ce diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 588bc1d550..d7b2b74161 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -680,11 +681,8 @@ void OpenSpaceEngine::runScripts(const ghoul::Dictionary& scripts) { void OpenSpaceEngine::runPreInitializationScripts(const std::string& sceneDescription) { LINFO("Running Initialization scripts"); - lua_State* state = ghoul::lua::createNewLuaState(); - OnExit( - // Delete the Lua state at the end of the scope, no matter what - [state](){ghoul::lua::destroyLuaState(state);} - ); + + ghoul::lua::LuaState state; OsEng.scriptEngine().initializeLuaState(state); // First execute the script to get all global variables @@ -710,11 +708,7 @@ void OpenSpaceEngine::runPreInitializationScripts(const std::string& sceneDescri void OpenSpaceEngine::runPostInitializationScripts(const std::string& sceneDescription) { LINFO("Running Setup scripts"); - lua_State* state = ghoul::lua::createNewLuaState(); - OnExit( - // Delete the Lua state at the end of the scope, no matter what - [state](){ghoul::lua::destroyLuaState(state);} - ); + ghoul::lua::LuaState state; OsEng.scriptEngine().initializeLuaState(state); // First execute the script to get all global variables