Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make my code less horrible #8

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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