summaryrefslogtreecommitdiffstats
path: root/source/ManualBindings.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-05 15:54:10 +0200
committermadmaxoft <github@xoft.cz>2013-08-05 15:54:10 +0200
commit73fcd7ad1c7108bd3b76d7543cc6f312e083c43c (patch)
tree1a04a285e6cf147ccce5b1ab7cdf0178e2a344cc /source/ManualBindings.cpp
parentExported cWorld:DoWithEntityByID() to Lua API (diff)
downloadcuberite-73fcd7ad1c7108bd3b76d7543cc6f312e083c43c.tar
cuberite-73fcd7ad1c7108bd3b76d7543cc6f312e083c43c.tar.gz
cuberite-73fcd7ad1c7108bd3b76d7543cc6f312e083c43c.tar.bz2
cuberite-73fcd7ad1c7108bd3b76d7543cc6f312e083c43c.tar.lz
cuberite-73fcd7ad1c7108bd3b76d7543cc6f312e083c43c.tar.xz
cuberite-73fcd7ad1c7108bd3b76d7543cc6f312e083c43c.tar.zst
cuberite-73fcd7ad1c7108bd3b76d7543cc6f312e083c43c.zip
Diffstat (limited to 'source/ManualBindings.cpp')
-rw-r--r--source/ManualBindings.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp
index 7e3417ceb..9e9b5f5a8 100644
--- a/source/ManualBindings.cpp
+++ b/source/ManualBindings.cpp
@@ -686,6 +686,52 @@ tolua_lerror:
+static int tolua_cWorld_TryGetHeight(lua_State * tolua_S)
+{
+ // Exported manually, because tolua would require the out-only param a_Height to be used when calling
+ // Takes (a_World,) a_BlockX, a_BlockZ
+ // Returns Height, IsValid
+ #ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype (tolua_S, 1, "cWorld", 0, &tolua_err) ||
+ !tolua_isnumber (tolua_S, 2, 0, &tolua_err) ||
+ !tolua_isnumber (tolua_S, 3, 0, &tolua_err) ||
+ !tolua_isnoobj (tolua_S, 4, &tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ #endif
+ {
+ cWorld * self = (cWorld *) tolua_tousertype (tolua_S, 1, 0);
+ int BlockX = (int) tolua_tonumber (tolua_S, 2, 0);
+ int BlockZ = (int) tolua_tonumber (tolua_S, 3, 0);
+ #ifndef TOLUA_RELEASE
+ if (self == NULL)
+ {
+ tolua_error(tolua_S, "Invalid 'self' in function 'TryGetHeight'", NULL);
+ }
+ #endif
+ {
+ int Height = 0;
+ bool res = self->TryGetHeight(BlockX, BlockZ, Height);
+ tolua_pushnumber(tolua_S, Height);
+ tolua_pushboolean(tolua_S, res ? 1 : 0);
+ }
+ }
+ return 1;
+
+ #ifndef TOLUA_RELEASE
+tolua_lerror:
+ tolua_error(tolua_S, "#ferror in function 'TryGetHeight'.", &tolua_err);
+ return 0;
+ #endif
+}
+
+
+
+
+
static int tolua_cPluginManager_GetAllPlugins(lua_State * tolua_S)
{
cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0);
@@ -1482,6 +1528,7 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "ForEachFurnaceInChunk", tolua_ForEachInChunk<cWorld, cFurnaceEntity, &cWorld::ForEachFurnaceInChunk>);
tolua_function(tolua_S, "ForEachPlayer", tolua_ForEach< cWorld, cPlayer, &cWorld::ForEachPlayer>);
tolua_function(tolua_S, "SetSignLines", tolua_cWorld_SetSignLines);
+ tolua_function(tolua_S, "TryGetHeight", tolua_cWorld_TryGetHeight);
tolua_function(tolua_S, "UpdateSign", tolua_cWorld_SetSignLines);
tolua_endmodule(tolua_S);