Log instead of drawing an error formspec and fix node.name check

This commit is contained in:
luk3yx 2022-05-22 15:39:52 +12:00
parent bf4003b988
commit b49c28cc0a
1 changed files with 7 additions and 9 deletions

View File

@ -120,14 +120,14 @@ end
function nodes.textarea(node, scale, add_node)
-- Add in separate nodes for the label and background
if node.label ~= "" then
if node.label and node.label ~= "" then
add_node("label", {
x = node.x,
y = node.y - 10 / scale,
label = node.label
})
end
if node.name ~= "" then
if node.name and node.name ~= "" then
add_node("box", {
x = node.x,
y = node.y,
@ -214,7 +214,11 @@ nodes.image_button = nodes.button
nodes.image_button_exit = nodes.button
nodes.item_image_button = nodes.button
local render_error
local function render_error(err)
minetest.log("error", "[hud_fs] Error rendering HUD: " .. tostring(err))
return {}
end
local function render(tree, proto_ver, scale, z_index)
if type(tree) == "string" then
local err
@ -273,12 +277,6 @@ local function render(tree, proto_ver, scale, z_index)
return hud_elems
end
-- Defined as a local before render()
function render_error(err)
return render("formspec_version[3]size[8,1]label[0,0.5;" ..
minetest.formspec_escape(tostring(err)) .. "]")
end
local hud_elems = {}
--[[
hud_elems[player_name][formname] = {