mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
hud_get: Return precision field for waypoints (#12215)
This commit is contained in:
parent
3ce5a68cd1
commit
89c82035d8
@ -1977,6 +1977,12 @@ void push_hud_element(lua_State *L, HudElement *elem)
|
|||||||
lua_pushnumber(L, elem->number);
|
lua_pushnumber(L, elem->number);
|
||||||
lua_setfield(L, -2, "number");
|
lua_setfield(L, -2, "number");
|
||||||
|
|
||||||
|
if (elem->type == HUD_ELEM_WAYPOINT) {
|
||||||
|
// waypoints reuse the item field to store precision, precision = item - 1
|
||||||
|
lua_pushnumber(L, elem->item - 1);
|
||||||
|
lua_setfield(L, -2, "precision");
|
||||||
|
}
|
||||||
|
// push the item field for waypoints as well for backwards compatibility
|
||||||
lua_pushnumber(L, elem->item);
|
lua_pushnumber(L, elem->item);
|
||||||
lua_setfield(L, -2, "item");
|
lua_setfield(L, -2, "item");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user