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:
parent
7c43cf47c3
commit
2d5bd3bf79
7 changed files with 59 additions and 67 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue