summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2020-04-14 20:44:18 +0200
committerGitHub <noreply@github.com>2020-04-14 20:44:18 +0200
commit2d5bd3bf794672285cfc796edebab2f672f2cab0 (patch)
treef4922fa8689156f33e9e37c32163cb719bd390e2 /src/script/lua_api/l_object.cpp
parent7c43cf47c37b0204e34d12670d2e6975eb36b45a (diff)
downloadminetest-2d5bd3bf794672285cfc796edebab2f672f2cab0.tar.gz
minetest-2d5bd3bf794672285cfc796edebab2f672f2cab0.tar.bz2
minetest-2d5bd3bf794672285cfc796edebab2f672f2cab0.zip
scriptapi: Some small optimizations to value pushing (#9669)
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r--src/script/lua_api/l_object.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index fa34260bf..bb1456ac9 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -123,14 +123,7 @@ int ObjectRef::l_get_pos(lua_State *L)
ObjectRef *ref = checkobject(L, 1);
ServerActiveObject *co = getobject(ref);
if (co == NULL) return 0;
- v3f pos = co->getBasePosition() / BS;
- lua_newtable(L);
- lua_pushnumber(L, pos.X);
- lua_setfield(L, -2, "x");
- lua_pushnumber(L, pos.Y);
- lua_setfield(L, -2, "y");
- lua_pushnumber(L, pos.Z);
- lua_setfield(L, -2, "z");
+ push_v3f(L, co->getBasePosition() / BS);
return 1;
}