diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-03-10 23:31:32 +0100 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-03-11 10:16:35 +0100 |
commit | 520705579d6a68cf6908275026eef2edee0758af (patch) | |
tree | 2d37eb5e28a1f6d95bac4094a613f054c08c55b2 /src/scripting/luascript.cpp | |
parent | 78c912fb4007c3e5f0b43de02646772acb21ecf2 (diff) | |
download | manaserv-520705579d6a68cf6908275026eef2edee0758af.tar.gz manaserv-520705579d6a68cf6908275026eef2edee0758af.tar.bz2 manaserv-520705579d6a68cf6908275026eef2edee0758af.tar.xz manaserv-520705579d6a68cf6908275026eef2edee0758af.zip |
Added callbacks for map/worldvar changes
Reviewed-by: bjorn.
Diffstat (limited to 'src/scripting/luascript.cpp')
-rw-r--r-- | src/scripting/luascript.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/scripting/luascript.cpp b/src/scripting/luascript.cpp index dfa64d0f..e45588b9 100644 --- a/src/scripting/luascript.cpp +++ b/src/scripting/luascript.cpp @@ -118,10 +118,11 @@ void LuaScript::push(const std::list<InventoryItem> &itemList) int LuaScript::execute() { assert(nbArgs >= 0); - assert(!mCurrentThread); - int res = lua_pcall(mCurrentState, nbArgs, 1, 1); + + const int tmpNbArgs = nbArgs; nbArgs = -1; + int res = lua_pcall(mCurrentState, tmpNbArgs, 1, 1); if (res || !(lua_isnil(mCurrentState, -1) || lua_isnumber(mCurrentState, -1))) { @@ -144,8 +145,9 @@ bool LuaScript::resume() assert(mCurrentThread); setMap(mCurrentThread->mMap); - int result = lua_resume(mCurrentState, nbArgs); + const int tmpNbArgs = nbArgs; nbArgs = -1; + int result = lua_resume(mCurrentState, tmpNbArgs); setMap(0); if (result == 0) // Thread is done |