summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
authorLukas Pioch <lukas@zgow.de>2016-12-07 21:15:30 +0100
committerLukas Pioch <lukas@zgow.de>2016-12-10 13:32:11 +0100
commit0c10704d1f0e8ac1573ecc9ccdddd14690dcca38 (patch)
treefb810cb4529cabb39927da41d80491db009f7723 /src/Bindings
parentPowered rails can kick-start minecarts (#3472) (diff)
downloadcuberite-0c10704d1f0e8ac1573ecc9ccdddd14690dcca38.tar
cuberite-0c10704d1f0e8ac1573ecc9ccdddd14690dcca38.tar.gz
cuberite-0c10704d1f0e8ac1573ecc9ccdddd14690dcca38.tar.bz2
cuberite-0c10704d1f0e8ac1573ecc9ccdddd14690dcca38.tar.lz
cuberite-0c10704d1f0e8ac1573ecc9ccdddd14690dcca38.tar.xz
cuberite-0c10704d1f0e8ac1573ecc9ccdddd14690dcca38.tar.zst
cuberite-0c10704d1f0e8ac1573ecc9ccdddd14690dcca38.zip
Diffstat (limited to 'src/Bindings')
-rw-r--r--src/Bindings/ManualBindings.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 083a30f2a..1fe3c0f9f 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -3799,6 +3799,50 @@ static int tolua_cCompositeChat_UnderlineUrls(lua_State * tolua_S)
+static int tolua_cEntity_GetPosition(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+
+ // Get the params:
+ cEntity * self = reinterpret_cast<cEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
+ if (self == nullptr)
+ {
+ LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
+ return 0;
+ }
+
+ L.Push(Mtolua_new((Vector3d)(self->GetPosition())));
+
+ tolua_register_gc(L, lua_gettop(L)); // Make Lua own the object
+ return 1;
+}
+
+
+
+
+
+static int tolua_cEntity_GetSpeed(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+
+ // Get the params:
+ cEntity * self = reinterpret_cast<cEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
+ if (self == nullptr)
+ {
+ LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
+ return 0;
+ }
+
+ L.Push(Mtolua_new((Vector3d)(self->GetSpeed())));
+
+ tolua_register_gc(L, lua_gettop(L)); // Make Lua own the object
+ return 1;
+}
+
+
+
+
+
void cManualBindings::Bind(lua_State * tolua_S)
{
tolua_beginmodule(tolua_S, nullptr);
@@ -3878,6 +3922,8 @@ void cManualBindings::Bind(lua_State * tolua_S)
tolua_beginmodule(tolua_S, "cEntity");
tolua_constant(tolua_S, "INVALID_ID", cEntity::INVALID_ID);
+ tolua_function(tolua_S, "GetPosition", tolua_cEntity_GetPosition);
+ tolua_function(tolua_S, "GetSpeed", tolua_cEntity_GetSpeed);
tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cFile");