Skip to content

Commit

Permalink
hud_get: Return precision field for waypoints (minetest#12215)
Browse files Browse the repository at this point in the history
  • Loading branch information
appgurueu committed May 4, 2022
1 parent 3ce5a68 commit 89c8203
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/script/common/c_content.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1977,6 +1977,12 @@ void push_hud_element(lua_State *L, HudElement *elem)
lua_pushnumber(L, elem->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_setfield(L, -2, "item");

Expand Down

0 comments on commit 89c8203

Please sign in to comment.