[wip][mod] FormSpec mini API [formspeccer]
A little API that is intended to help in the creation of form specs.
The form spec sublanguage is a little fiddly, so this API is intended to make it resemble other APIs by making it table-based.
Example:
- * Github: https://github.com/taikedz/minetest-formspeccer
* ZIP: https://github.com/taikedz/minetest-for ... master.zip
* License: LGPL v3
The form spec sublanguage is a little fiddly, so this API is intended to make it resemble other APIs by making it table-based.
Example:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local formname = "mymod:myform"
formspeccer:newform(formname,"10,7") -- a new form , 10x7
formspeccer:add_field(formname,{
name="field1",
label="Your name",
value="Sam", -- optional pre-populated value for the form
})
formspeccer:add_button(
{
name="send",
label="Send!",
xy="2,3",
wh="1,1",
},
true -- optional , makes it an exit button
)
-- just show the form to a player
formspeccer:show(player,"mymod:myform")