Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
luk3yx committed Dec 3, 2023
1 parent 2c00acf commit 7b87099
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
16 changes: 8 additions & 8 deletions font_api/fontform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions signs_api/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ local FS = function(...) return minetest.formspec_escape(S(...)) end

function signs_api.set_display_text(pos, text, font)
local meta = minetest.get_meta(pos)
-- Horrible workaround to prevent the engine from trying to resolve
-- metadata keys
if text:sub(1, 2) == "${" and text:sub(-1) == "}" then
text = text .. " "
end
meta:set_string("display_text", text)
if text and text ~= "" then
meta:set_string("infotext", "\""..text.."\"")
Expand Down

0 comments on commit 7b87099

Please sign in to comment.