- Timestamp:
- Mar 31, 2010, 12:46:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gamestates2/src/libraries/core/LuaState.cc
r6662 r6667 177 177 178 178 // Push custom error handler that uses the debugger 179 int errorHandler = 1;180 179 lua_getglobal(this->luaState_, "errorHandler"); 180 int errorHandler = lua_gettop(luaState_); 181 181 if (lua_isnil(this->luaState_, -1)) 182 182 { … … 201 201 case LUA_ERRMEM: // Memory allocation error 202 202 COUT(1) << "Lua memory allocation error: Consult your dentist immediately!" << std::endl; 203 lua_pop(luaState_, 1); 203 lua_pop(luaState_, 1); // Remove error message 204 204 break; 205 205 } … … 215 215 // Remove error string from stack (we already display the error in the 216 216 // 'errorHandler' Lua function in LuaStateInit.lua) 217 lua_pop(luaState_, 1);218 217 break; 219 218 case LUA_ERRERR: // Error in the error handler 220 COUT(1) << "Lua error in error handler : " << lua_tostring(luaState_, -1)<< std::endl;219 COUT(1) << "Lua error in error handler. No message available." << std::endl; 221 220 break; 222 221 case LUA_ERRMEM: // Memory allocation error 223 222 COUT(1) << "Lua memory allocation error: Consult your dentist immediately!" << std::endl; 224 lua_pop(luaState_, 1);225 223 break; 226 224 } 225 if (error != 0) 226 lua_pop(luaState_, 1); // Remove error message 227 227 } 228 228 229 229 if (error != 0) 230 {231 // Push a nil return value 232 lua_pushnil(luaState_);233 }230 lua_pushnil(luaState_); // Push a nil return value 231 232 if (errorHandler != 0) 233 lua_remove(luaState_, errorHandler); // Remove error handler from stack 234 234 235 235 // Set return value to a global variable because we cannot return a table in this function
Note: See TracChangeset
for help on using the changeset viewer.