aboutsummaryrefslogtreecommitdiff
path: root/font_api
diff options
context:
space:
mode:
authorluk3yx <luk3yx@users.noreply.github.com>2023-12-04 08:22:43 +1300
committerluk3yx <luk3yx@users.noreply.github.com>2023-12-04 08:22:43 +1300
commit7b87099f2ce90dd662e7e2c888e7cf6836b7e2cc (patch)
treea76034dc49472c0ed6d643d7725a4a7b5d51dbd3 /font_api
parent2c00acf2307a4b43c65bf8acc7116638f6a554a1 (diff)
downloaddisplay_modpack_no_craft-7b87099f2ce90dd662e7e2c888e7cf6836b7e2cc.tar.gz
display_modpack_no_craft-7b87099f2ce90dd662e7e2c888e7cf6836b7e2cc.zip
Bugfix
Diffstat (limited to 'font_api')
-rw-r--r--font_api/fontform.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/font_api/fontform.lua b/font_api/fontform.lua
index d019fba..28b70d5 100644
--- a/font_api/fontform.lua
+++ b/font_api/fontform.lua
@@ -54,15 +54,15 @@ local function show_node_formspec(playername, pos)
fs = fs:gsub("context", nodemeta)
-- Change all ${} to their corresponding metadata values
- local s, e
- repeat
- s, e = fs:find('%${.*}')
- if s and e then
- fs = fs:sub(1, s-1)..
- minetest.formspec_escape(meta:get_string(fs:sub(s+2,e-1)))..
- fs:sub(e+1)
+ fs = fs:gsub("(.)${(.*)}", function(prefix, key)
+ -- Don't alter escaped keys
+ if prefix == "\\" then
+ return prefix .. "${" .. key .. "}"
end
- until s == nil
+
+ -- Get the node meta value
+ return prefix .. minetest.formspec_escape(meta:get_string(key))
+ end)
local context = get_context(playername)
context.node_pos = pos