minetest.formspec_escape(string): returns a string
escapes the characters "[", "]", "\", "," and ";", which cannot be used
in formspecs.
minetest.is_yes(arg)
returns true if passed 'y', 'yes', 'true' or a number that isn't zero.
minetest.is_nan(arg)
returns true when the passed number represents NaN.
minetest.get_us_time()
returns time with microsecond precision. May not return wall time.
table.copy(table): returns a table
returns a deep copy of table
table.indexof(list, val): returns the smallest numerical index containing
the value val in the table list. Non-numerical indices are ignored.
If val could not be found, -1 is returned. list must not have
negative indices.
table.keyof(table, val): returns the key containing
the value val in the table table. If multiple keys contain val,
it is unspecified which key will be returned.
If val could not be found, nil is returned.
table.insert_all(table, other_table):
Appends all values in other_table to table - uses #table + 1 to
find new indices.
table.key_value_swap(t): returns a table with keys and values swapped
If multiple keys in t map to the same value, it is unspecified which
value maps to that key.
Simulates a tool being used once and returns the added wear,
such that, if only this function is used to calculate wear,
the tool will break exactly after uses times of uses
uses: Number of times the tool can be used
initial_wear: The initial wear the tool starts with (default: 0)
minetest.get_dig_params(groups, tool_capabilities [, wear]):
Simulates an item that digs a node.
Returns a table with the following fields:
diggable: true if node can be dug, false otherwise.
time: Time it would take to dig the node.
wear: How much wear would be added to the tool (ignored for non-tools).
time and wear are meaningless if node's not diggable
Parameters:
groups: Table of the node groups of the node that would be dug
tool_capabilities: Tool capabilities table of the item
wear: Amount of wear the tool starts with (default: 0)
minetest.get_hit_params(groups, tool_capabilities [, time_from_last_punch [, wear]]):
Simulates an item that punches an object.
Returns a table with the following fields:
hp: How much damage the punch would cause (between -65535 and 65535).
wear: How much wear would be added to the tool (ignored for non-tools).
Parameters:
groups: Damage groups of the object
tool_capabilities: Tool capabilities table of the item
time_from_last_punch: time in seconds since last punch action
wear: Amount of wear the item starts with (default: 0)