Cela supprimera la page "API Global Functions"
. Soyez-en sûr.
Here are the global functions that modders can use for their mods.
Table of Contents |
---|
register_form_page |
show_form_page |
set_string |
get_string |
Description: Registers a new Formspec page.
Example of Usage:
ezformmaker.register_form_page("test:test_page",{
--Function when this form is being sent to a player
on_send_form = function(player)
--The Formspec Itself
local form_page = {
"size[8,8]",
"real_coordinates[true]",
"label[2.30,0.80;This is a sample formspec page]",
"label[1.69,3.12;Press these buttons to see what would happen]",
"button[1.5,5.90;2.60,0.8;apply;Apply]",
"button[4.5,5.90;2.60,0.8;cancel;Cancel]"
}
local to_send = table.concat(form_page, "")
--Returns the form page as a table concatenation format, which is faster than a string concatenation format.
return to_send
end,
--Function which handles it's own field input executions if the form page contains any fields.
on_receive_fields = function(player, formname, fields)
local name = player:get_player_name()
if fields.apply then
minetest.chat_send_player(name, "[TEST COMPLETE]: Something was applied!")
elseif fields.cancel then
minetest.chat_send_player(name, "[TEST COMPLETE]: Something was Canceled!")
end
return
end
})
Description: Sends a specified formspec page (if registered) to a specific player.
Example of Usage:
ezformmaker.show_form_page("Bob", "test:test_page")
NOTE: This will send the form page "test:test_page" to a player with the username "Bob"
Description: Sets a specified string with a user defined value (used for form context handling)
Example of Usage:
ezformmaker.set_string("my_string", "Bob")
Description: Gets a specified string's value (used for form context handling)
Example of Usage:
ezformmaker.set_string("my_string", "Bob")
local string = ezformmaker.get_string("my_string")
NOTE: In this case, local string returns "Bob". Since string "my_string" contains a string value of "Bob".
Cela supprimera la page "API Global Functions"
. Soyez-en sûr.