Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 28, 2010, 10:46:07 PM (15 years ago)
Author:
rgrieder
Message:

Fixed LuaState::doFile return value issue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gamestate/src/libraries/core/LuaState.cc

    r6627 r6629  
    170170                origin = " originating from " + sourceFileInfo_->filename;
    171171            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
    176182        lua_setglobal(luaState_, "LuaStateReturnValue");
    177183
Note: See TracChangeset for help on using the changeset viewer.