diff options
author | Wuzzy <almikes@aol.com> | 2016-10-13 01:50:43 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-10-13 01:50:43 +0200 |
commit | db6333b49e5a1f297f517614d658c5a60f4b6310 (patch) | |
tree | d79cb14003b08782f3c97415feb58d027b71d09a /init.lua | |
parent | 7ba370400955d9e178859b7d8050575e7ef2a0b6 (diff) |
Unique text widget IDs
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -338,6 +338,7 @@ end doc.widgets = {} +local text_id = 1 -- Scrollable freeform text doc.widgets.text = function(data, x, y, width, height) local baselength = 80 @@ -345,9 +346,11 @@ doc.widgets.text = function(data, x, y, width, height) local linelength = math.max(20, math.floor(baselength * (width / widget_basewidth))) -- TODO: Wait for Minetest to provide a native widget for scrollable read-only text with automatic line breaks. -- Currently, all of this had to be hacked into this script manually by using/abusing the table widget - return "tablecolumns[text]".. + local formstring = "tablecolumns[text]".. "tableoptions[background=#00000000;highlight=#00000000;border=false]".. - "table["..tostring(x)..","..tostring(y)..";"..tostring(width)..","..tostring(height)..";text;"..text_for_textlist(data, linelength).."]" + "table["..tostring(x)..","..tostring(y)..";"..tostring(width)..","..tostring(height)..";doc_widget_text"..tostring(text_id)..";"..text_for_textlist(data, linelength).."]" + text_id = text_id + 1 + return formstring end -- Direct formspec |