Skip to content

Instantly share code, notes, and snippets.

@Ekdohibs
Created November 3, 2013 11:23
Show Gist options
  • Save Ekdohibs/7289183 to your computer and use it in GitHub Desktop.
Save Ekdohibs/7289183 to your computer and use it in GitHub Desktop.
@@ -1015,11 +1015,12 @@ checkbox[<X>,<Y>;<name>;<label>;<selected>]
^ name fieldname data is transfered to lua
^ label to be shown left of checkbox
^ selected (optional) true/false
Note: do NOT use a element name starting with "key_" those names are reserved to
-pass key press events to formspec!
+pass key press events to formspec! Do NOT use "quit" either, since it is
+reserved for formspec close events.
Inventory location:
- "context": Selected node metadata (deprecated: "current_name")
- "current_player": Player to whom the menu is shown
@@ -1138,10 +1139,11 @@ minetest.register_on_cheat(func(ObjectRef, cheat))
^ cheat: {type="moved_too_fast"/"interacted_too_far"/"finished_unknown_dig"/"dug_unbreakable"/"dug_too_fast"}
minetest.register_on_chat_message(func(name, message))
^ Called always when a player says something
minetest.register_on_player_receive_fields(func(player, formname, fields))
^ Called when a button is pressed in player's inventory form
+^ If fields.quit = true, the inventory is being closed.
^ Newest functions are called first
^ If function returns true, remaining functions are not called
minetest.register_on_mapgen_init(func(MapgenParams))
^ Called just before the map generator is initialized but before the environment is initialized
^ MapgenParams consists of a table with the fields mgname, seed, water_level, and flags
@@ -2119,10 +2121,11 @@ Node definition (register_node)
^ return true to run the timer for another cycle with the same timeout value
on_receive_fields = func(pos, formname, fields, sender),
^ fields = {name1 = value1, name2 = value2, ...}
^ Called when an UI form (eg. sign text input) returns data
+ ^ if fields.quit = true, then the formspec is being closed
^ default: nil
allow_metadata_inventory_move = func(pos, from_list, from_index,
to_list, to_index, count, player),
^ Called when a player wants to move items inside the inventory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment