@@ -590,17 +590,24 @@ Helper functions
590
590
* ` math.sign(x, tolerance) `
591
591
* Get the sign of a number.
592
592
Optional: Also returns ` 0 ` when the absolute value is within the tolerance (default: ` 0 ` )
593
- * `string.split(str, separator=",", include_empty=false, max_splits=-1,
594
- * sep_is_pattern=false)`
593
+ * ` string.split(str, separator=",", include_empty=false, max_splits=-1, sep_is_pattern=false) `
595
594
* If ` max_splits ` is negative, do not limit splits.
596
595
* ` sep_is_pattern ` specifies if separator is a plain string or a pattern (regex).
597
596
* e.g. ` string:split("a,b", ",") == {"a","b"} `
598
597
* ` string:trim() `
599
598
* e.g. ` string.trim("\n \t\tfoo bar\t ") == "foo bar" `
599
+ * ` minetest.wrap_text(str, limit) ` : returns a string
600
+ * Adds new lines to the string to keep it within the specified character limit
601
+ * limit: Maximal amount of characters in one line
602
+ * ` minetest.pos_to_string({x=X,y=Y,z=Z}, decimal_places)) ` : returns string ` "(X,Y,Z)" `
603
+ * Convert position to a printable string
604
+ Optional: 'decimal_places' will round the x, y and z of the pos to the given decimal place.
605
+ * ` minetest.string_to_pos(string) ` : returns a position
606
+ * Same but in reverse. Returns ` nil ` if the string can't be parsed to a position.
607
+ * ` minetest.string_to_area("(X1, Y1, Z1) (X2, Y2, Z2)") ` : returns two positions
608
+ * Converts a string representing an area box into two positions
600
609
* ` minetest.is_yes(arg) `
601
610
* returns whether ` arg ` can be interpreted as yes
602
- * ` minetest.get_us_time() `
603
- * returns time with microsecond precision. May not return wall time.
604
611
* ` table.copy(table) ` : returns a table
605
612
* returns a deep copy of ` table `
606
613
@@ -649,6 +656,8 @@ Call these functions only at load time!
649
656
* Return ` true ` to mark the message as handled, which means that it will not be sent to server
650
657
* ` minetest.register_chatcommand(cmd, chatcommand definition) `
651
658
* Adds definition to minetest.registered_chatcommands
659
+ * ` minetest.unregister_chatcommand(name) `
660
+ * Unregisters a chatcommands registered with register_chatcommand.
652
661
* ` minetest.register_on_death(func()) `
653
662
* Called when the local player dies
654
663
* ` minetest.register_on_hp_modification(func(hp)) `
@@ -683,6 +692,12 @@ Call these functions only at load time!
683
692
* ` minetest.after(time, func, ...) `
684
693
* Call the function ` func ` after ` time ` seconds, may be fractional
685
694
* Optional: Variable number of arguments that are passed to ` func `
695
+ * ` minetest.get_us_time() `
696
+ * Returns time with microsecond precision. May not return wall time.
697
+ * ` minetest.get_day_count() `
698
+ * Returns number days elapsed since world was created, accounting for time changes.
699
+ * ` minetest.get_timeofday() `
700
+ * Returns the time of day: ` 0 ` for midnight, ` 0.5 ` for midday
686
701
687
702
### Map
688
703
* ` minetest.get_node(pos) `
@@ -691,8 +706,17 @@ Call these functions only at load time!
691
706
for unloaded areas.
692
707
* ` minetest.get_node_or_nil(pos) `
693
708
* Same as ` get_node ` but returns ` nil ` for unloaded areas.
709
+ * ` minetest.find_node_near(pos, radius, nodenames, [search_center]) ` : returns pos or ` nil `
710
+ * ` radius ` : using a maximum metric
711
+ * ` nodenames ` : e.g. ` {"ignore", "group:tree"} ` or ` "default:dirt" `
712
+ * ` search_center ` is an optional boolean (default: ` false ` )
713
+ If true ` pos ` is also checked for the nodes
694
714
* ` minetest.get_meta(pos) `
695
715
* Get a ` NodeMetaRef ` at that position
716
+ * ` minetest.get_node_level(pos) `
717
+ * get level of leveled node (water, snow)
718
+ * ` minetest.get_node_max_level(pos) `
719
+ * get max available level for leveled node
696
720
697
721
### Player
698
722
* ` minetest.get_wielded_item() `
@@ -710,6 +734,13 @@ Call these functions only at load time!
710
734
* Take a screenshot.
711
735
* ` minetest.get_server_info() `
712
736
* Returns [ server info] ( #server-info ) .
737
+ * ` minetest.send_respawn() `
738
+ * Sends a respawn request to the server.
739
+
740
+ ### Storage API
741
+ * ` minetest.get_mod_storage() ` :
742
+ * returns reference to mod private ` StorageRef `
743
+ * must be called during mod load time
713
744
714
745
### Misc.
715
746
* ` minetest.parse_json(string[, nullvalue]) ` : returns something
@@ -763,6 +794,8 @@ Call these functions only at load time!
763
794
* same as fgettext_ne(), but calls minetest.formspec_escape before returning result
764
795
* ` minetest.pointed_thing_to_face_pos(placer, pointed_thing) ` : returns a position
765
796
* returns the exact position on the surface of a pointed node
797
+ * ` minetest.global_exists(name) `
798
+ * Checks if a global variable has been set, without triggering a warning.
766
799
767
800
### UI
768
801
* ` minetest.ui.minimap `