diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-25 13:57:28 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-25 13:57:28 +0200 |
commit | e3136c2d0f16557370e25a077891df5cca2e020f (patch) | |
tree | 747265d0f21da61ca4c5b2f8269639d87f87fa07 /source/ManualBindings.cpp | |
parent | Added sound to the vaporize simulator. FS #315 (diff) | |
download | cuberite-e3136c2d0f16557370e25a077891df5cca2e020f.tar cuberite-e3136c2d0f16557370e25a077891df5cca2e020f.tar.gz cuberite-e3136c2d0f16557370e25a077891df5cca2e020f.tar.bz2 cuberite-e3136c2d0f16557370e25a077891df5cca2e020f.tar.lz cuberite-e3136c2d0f16557370e25a077891df5cca2e020f.tar.xz cuberite-e3136c2d0f16557370e25a077891df5cca2e020f.tar.zst cuberite-e3136c2d0f16557370e25a077891df5cca2e020f.zip |
Diffstat (limited to '')
-rw-r--r-- | source/ManualBindings.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp index 659edf23f..db1d65f53 100644 --- a/source/ManualBindings.cpp +++ b/source/ManualBindings.cpp @@ -14,6 +14,7 @@ #include "StringMap.h" #include "ClientHandle.h" #include "ChestEntity.h" +#include "DispenserEntity.h" #include "FurnaceEntity.h" #include "md5/md5.h" @@ -211,8 +212,15 @@ static int tolua_DoWith(lua_State* tolua_S) } int s = lua_pcall(LuaState, (TableRef == LUA_REFNIL ? 1 : 2), 1, 0); - report_errors(LuaState, s); - return true; + if (report_errors(LuaState, s)) + { + return true; // Abort enumeration + } + if (lua_isboolean(LuaState, -1)) + { + return (tolua_toboolean(LuaState, -1, 0) > 0); + } + return false; /* Continue enumeration */ } lua_State * LuaState; int FuncRef; @@ -299,8 +307,15 @@ static int tolua_DoWithXYZ(lua_State* tolua_S) } int s = lua_pcall(LuaState, (TableRef == LUA_REFNIL ? 1 : 2), 1, 0); - report_errors(LuaState, s); - return true; + if (report_errors(LuaState, s)) + { + return true; // Abort enumeration + } + if (lua_isboolean(LuaState, -1)) + { + return (tolua_toboolean(LuaState, -1, 0) > 0); + } + return false; /* Continue enumeration */ } lua_State * LuaState; int FuncRef; @@ -392,7 +407,7 @@ static int tolua_ForEachInChunk(lua_State* tolua_S) if (lua_isboolean(LuaState, -1)) { - return (tolua_toboolean( LuaState, -1, 0) > 0); + return (tolua_toboolean(LuaState, -1, 0) > 0); } return false; /* Continue enumeration */ } @@ -1160,6 +1175,7 @@ void ManualBindings::Bind( lua_State* tolua_S ) tolua_function(tolua_S, "DoWithPlayer", tolua_DoWith<cWorld, cPlayer, &cWorld::DoWithPlayer>); tolua_function(tolua_S, "FindAndDoWithPlayer", tolua_DoWith<cWorld, cPlayer, &cWorld::FindAndDoWithPlayer>); tolua_function(tolua_S, "DoWithChestAt", tolua_DoWithXYZ<cWorld, cChestEntity, &cWorld::DoWithChestAt>); + tolua_function(tolua_S, "DoWithDispenserAt", tolua_DoWithXYZ<cWorld, cDispenserEntity, &cWorld::DoWithDispenserAt>); tolua_endmodule(tolua_S); tolua_beginmodule(tolua_S, "cPlugin"); |