Make `label` accept non-string values
This PR makes it possible to pass non-string values (such as numbers) to label by calling tostring internally.
Technically, this also allows passing other naughty values, like tables, but tostring deals with them too (by dumping the hex memory address XD).
For example, this makes the following example possible (based on one of the playground examples):
local gui = flow.widgets
local my_gui = flow.make_gui(function(player, ctx)
return gui.VBox{
gui.Button{
label = "Click",
on_event = function(player, ctx)
ctx.count = (ctx.count or 0) + 1
return true
end
},
gui.Label{
-- Notice the lack of concat or tostring
label = ctx.count or 0,
min_w = 5
}
}
end)
minetest.register_chatcommand("flow_clicker", {
func = function(name)
my_gui:show(minetest.get_player_by_name(name))
end,
})