summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-03 00:54:58 +0200
committerWuzzy <almikes@aol.com>2016-08-03 00:54:58 +0200
commitbcdd9427d3e179d2f94671e4966305eac8c2ad84 (patch)
treeccaf8c78c126bf16b4e3ecdb8fc098d586efe458
parent8e8c12427d9c84574411840880201d2dd2d24de5 (diff)
Add formspec entry builder
-rw-r--r--API.md7
-rw-r--r--init.lua5
2 files changed, 11 insertions, 1 deletions
diff --git a/API.md b/API.md
index 1a5e6c2..f5a0a44 100644
--- a/API.md
+++ b/API.md
@@ -58,7 +58,12 @@ For `build_formspec` you can either define your own function or use one
of the following predefined functions:
* `doc.entry_templates.text`: Expects entry data to be a string.
- It will be inserted directly into the entry.
+ It will be inserted directly into the entry. Useful for entries with
+ a freeform text.
+
+* `doc.entry_templates.formspec`: Entry data is expected to contain the
+ complete entry formspec as a string. Useful if your entries. Useful
+ if you expect your entries to differ wildly in layouts.
#### Return value
Always `nil`.
diff --git a/init.lua b/init.lua
index 5c5fbef..a87c019 100644
--- a/init.lua
+++ b/init.lua
@@ -154,6 +154,11 @@ doc.entry_templates.text = function(data)
return "textarea[0.25,0.5;12,8;;"..minetest.formspec_escape(data)..";]"
end
+-- Direct formspec
+doc.entry_templates.formspec = function(data)
+ return data
+end
+
--[[ Functions for internal use ]]
function doc.formspec_core(tab)