Skip to content

Commit

Permalink
Make my code less horrible
Browse files Browse the repository at this point in the history
  • Loading branch information
luk3yx committed Dec 4, 2023
1 parent cdc3cf5 commit 924e9db
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
8 changes: 1 addition & 7 deletions font_api/fontform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,7 @@ local function show_node_formspec(playername, pos)
fs = fs:gsub("context", nodemeta)

-- Change all ${} to their corresponding metadata values
fs = fs:gsub("(.)${(.-)}", function(prefix, key)
-- Don't alter escaped keys
if prefix == "\\" then
return prefix .. "${" .. key .. "}"
end

-- Get the node meta value
fs = fs:gsub("([^\\])${(.-)}", function(prefix, key)
return prefix .. minetest.formspec_escape(meta:get_string(key))
end)

Expand Down
5 changes: 0 additions & 5 deletions signs_api/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ 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 924e9db

Please sign in to comment.