Changeset 6629
- Timestamp:
- Mar 28, 2010, 10:46:07 PM (15 years ago)
- Location:
- code/branches/gamestate
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gamestate/data/lua/LuaStateInit.lua
r6628 r6629 34 34 -- Furthermore the ".lua" extension is appended to the moduleName parameter when looking for the file 35 35 original_require = require 36 _REQUIREDNAME = "" 37 LuaStateReturnValue = true 36 38 require = function(moduleName) 37 39 if not luaState:fileExists(moduleName .. ".lua") then … … 44 46 if not _LOADED[moduleName] then 45 47 -- save old value 46 _REQUIREDNAME_OLD = _REQUIREDNAME48 local _REQUIREDNAME_OLD = _REQUIREDNAME 47 49 _REQUIREDNAME = moduleName 48 50 luaState:doFile(moduleName .. ".lua") 49 _LOADED[moduleName] = LuaStateReturnValue or true51 _LOADED[moduleName] = LuaStateReturnValue 50 52 -- restore old value 51 53 _REQUIREDNAME = _REQUIREDNAME_OLD -
code/branches/gamestate/src/libraries/core/LuaState.cc
r6627 r6629 170 170 origin = " originating from " + sourceFileInfo_->filename; 171 171 COUT(1) << "Error in Lua-script" << origin << ": " << lua_tostring(luaState_, -1) << std::endl; 172 // return value is nil 173 lua_pushnil(luaState_); 174 } 175 // push return value because it will get lost since the return value of this function is void 172 // return value is true (not nil!) 173 lua_pushboolean(luaState_, 1); 174 } 175 if (lua_isnil(luaState_, -1)) 176 { 177 // Nil return values cause problems 178 lua_pop(luaState_, 1); 179 lua_pushboolean(luaState_, 1); 180 } 181 // Push return value because it will get lost since the return value of this function is void 176 182 lua_setglobal(luaState_, "LuaStateReturnValue"); 177 183
Note: See TracChangeset
for help on using the changeset viewer.