1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Setting structure improvements (#15218)

This commit is contained in:
grorp 2024-10-03 11:37:04 +02:00 committed by GitHub
parent eefaef53b7
commit 132e43346e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 60 additions and 40 deletions

View file

@ -67,6 +67,19 @@ function make.heading(text)
end
function make.note(text)
return {
full_width = true,
get_formspec = function(self, avail_w)
-- Assuming label height 0.4:
-- Position at y=0 to eat 0.2 of the padding above, leave 0.05.
-- The returned used_height doesn't include padding.
return ("label[0,0;%s]"):format(core.colorize("#bbb", core.formspec_escape(text))), 0.2
end,
}
end
--- Used for string and numeric style fields
---
--- @param converter Function to coerce values from strings.