diff options
author | Lars Müller <34514239+appgurueu@users.noreply.github.com> | 2022-05-04 20:55:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 20:55:20 +0200 |
commit | 89c82035d88532bb63c9173e0c4edf54b7ea89f8 (patch) | |
tree | 05b707b1bceda20eda1052522253a70e3363101f /src/script | |
parent | 3ce5a68cd12e45d7b618c49e205936fb140ecbfe (diff) | |
download | minetest-89c82035d88532bb63c9173e0c4edf54b7ea89f8.tar.gz minetest-89c82035d88532bb63c9173e0c4edf54b7ea89f8.tar.bz2 minetest-89c82035d88532bb63c9173e0c4edf54b7ea89f8.zip |
hud_get: Return precision field for waypoints (#12215)
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/common/c_content.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index a233afb05..79830ddb4 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -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"); |