From 226d41955815c18dfad2cc26d078bfdffa556750 Mon Sep 17 00:00:00 2001 From: "Tai @ Flex" Date: Tue, 18 Oct 2016 12:17:21 +0100 Subject: [PATCH] add textarea support --- init.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/init.lua b/init.lua index e91d254..df006e3 100644 --- a/init.lua +++ b/init.lua @@ -50,6 +50,21 @@ formspeccer.newform = function(self,formname,formsize,prefs) return formname end +formspeccer.add_textarea = function(self,form,def) + -- textarea[X,Y;W,H;name;label;default] + local fstring = 'textarea[' + fstring = fstring .. def.xy .. ';' + fstring = fstring .. def.wh .. ';' + fstring = fstring .. def.name .. ';' + fstring = fstring .. def.label + + if def.value ~= nil then + fstring = fstring .. ';'.. minetest.formspec_escape(tostring(def.value)) + end + fstring = fstring .. ']' + forms[form] = forms[form]..fstring +end + formspeccer.add_label = function(self,form,def,vertical) local fieldstring = 'label[' if vertical then fieldstring = 'vertlabel[' end