1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-14 09:05:19 +02:00

scriptapi: Some small optimizations to value pushing (#9669)

This commit is contained in:
sfan5
2020-04-14 20:44:18 +02:00
committed by GitHub
parent 7c43cf47c3
commit 2d5bd3bf79
7 changed files with 59 additions and 67 deletions

View File

@@ -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;
}