1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00: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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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;
}