[Orxonox-commit 2046] r6763 - code/trunk/src/libraries/core
rgrieder at orxonox.net
rgrieder at orxonox.net
Mon Apr 19 18:09:10 CEST 2010
Author: rgrieder
Date: 2010-04-19 18:09:10 +0200 (Mon, 19 Apr 2010)
New Revision: 6763
Modified:
code/trunk/src/libraries/core/GUIManager.cc
code/trunk/src/libraries/core/LuaState.cc
code/trunk/src/libraries/core/LuaState.h
Log:
Using our own error handler (including the debugger) for Lua code executed through CEGUILuaFunctor.
Modified: code/trunk/src/libraries/core/GUIManager.cc
===================================================================
--- code/trunk/src/libraries/core/GUIManager.cc 2010-04-19 15:45:29 UTC (rev 6762)
+++ code/trunk/src/libraries/core/GUIManager.cc 2010-04-19 16:09:10 UTC (rev 6763)
@@ -132,6 +132,7 @@
// This is necessary to ensure that input events also use the right resource info when triggering lua functions
luaState_->setDefaultResourceInfo(this->rootFileInfo_);
scriptModule_.reset(new LuaScriptModule(luaState_->getInternalLuaState()));
+ scriptModule_->setDefaultPCallErrorHandler(LuaState::ERROR_HANDLER_NAME);
// Create our own logger to specify the filepath
std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
Modified: code/trunk/src/libraries/core/LuaState.cc
===================================================================
--- code/trunk/src/libraries/core/LuaState.cc 2010-04-19 15:45:29 UTC (rev 6762)
+++ code/trunk/src/libraries/core/LuaState.cc 2010-04-19 16:09:10 UTC (rev 6763)
@@ -47,6 +47,8 @@
LuaState::ToluaInterfaceMap LuaState::toluaInterfaces_s;
std::vector<LuaState*> LuaState::instances_s;
+ const std::string LuaState::ERROR_HANDLER_NAME = "errorHandler";
+
// Do this after declaring toluaInterfaces_s and instances_s to avoid larger problems
DeclareToluaInterface(Core);
@@ -176,7 +178,7 @@
}
// Push custom error handler that uses the debugger
- lua_getglobal(this->luaState_, "errorHandler");
+ lua_getglobal(this->luaState_, ERROR_HANDLER_NAME.c_str());
int errorHandler = lua_gettop(luaState_);
if (lua_isnil(this->luaState_, -1))
{
Modified: code/trunk/src/libraries/core/LuaState.h
===================================================================
--- code/trunk/src/libraries/core/LuaState.h 2010-04-19 15:45:29 UTC (rev 6762)
+++ code/trunk/src/libraries/core/LuaState.h 2010-04-19 16:09:10 UTC (rev 6763)
@@ -99,6 +99,8 @@
static void openToluaInterfaces(lua_State* state);
static void closeToluaInterfaces(lua_State* state);
+ static const std::string ERROR_HANDLER_NAME;
+
private:
shared_ptr<ResourceInfo> getFileInfo(const std::string& filename);
More information about the Orxonox-commit
mailing list