From 2d5bd3bf794672285cfc796edebab2f672f2cab0 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 14 Apr 2020 20:44:18 +0200 Subject: scriptapi: Some small optimizations to value pushing (#9669) --- src/script/lua_api/l_object.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/script/lua_api/l_object.cpp') 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; } -- cgit v1.2.3