diff --git a/doc/client_lua_api.md b/doc/client_lua_api.md index 6371c29664..5bfa961c94 100644 --- a/doc/client_lua_api.md +++ b/doc/client_lua_api.md @@ -5,7 +5,8 @@ ## Introduction -> [!WARNING] The client API is currently unstable, and may break/change without warning. +> [!WARNING] +> The client API is currently unstable, and may break/change without warning. Content and functionality can be added to Minetest by using Lua scripting in run-time loaded mods. @@ -35,7 +36,8 @@ In order to load client-side mods, the following conditions need to be satisfied 2. The client-side mod located in `$path_user/clientmods/` is added to `$path_user/clientmods/mods.conf` as `load_mod_ = true`. -> [!NOTE] Depending on the remote server's settings, client-side mods might not +> [!NOTE] +> Depending on the remote server's settings, client-side mods might not be loaded or have limited functionality. See setting `csm_restriction_flags` for reference. @@ -111,7 +113,8 @@ The main Lua script. Running this script should register everything it wants to register. Subsequent execution depends on minetest calling the registered callbacks. -> [!NOTE] Client mods currently can't provide textures, sounds, or models by +> [!NOTE] +> Client mods currently can't provide textures, sounds, or models by themselves. Any media referenced in function calls must already be loaded (provided by mods that exist on the server). @@ -147,7 +150,8 @@ The `:` prefix can also be used for maintaining backwards compatibility. # Sounds -> [!NOTE] Connecting sounds to objects is not implemented. +> [!NOTE] +> Connecting sounds to objects is not implemented. Only Ogg Vorbis files are supported. @@ -340,9 +344,10 @@ Call these functions only at load time! * Called just after mods have finished loading. * `minetest.register_on_shutdown(function())` * Called before client shutdown - > [!WARNING] If the client terminates abnormally (i.e. crashes), the registered - callbacks **will likely not be run**. Data should be saved at - semi-frequent intervals as well as on server shutdown. +> [!WARNING] +> If the client terminates abnormally (i.e. crashes), the registered + callbacks **will likely not be run**. Data should be saved at + semi-frequent intervals as well as on server shutdown. * `minetest.register_on_receiving_chat_message(function(message))` * Called always when a client receive a message * Return `true` to mark the message as handled, which means that it will not be shown to chat @@ -527,7 +532,8 @@ Call these functions only at load time! * Client joins channel `channel_name`, and creates it, if necessary. You should listen from incoming messages with `minetest.register_on_modchannel_message` call to receive incoming messages. - > [!WARNING] This function is asynchronous. +> [!WARNING] +> This function is asynchronous. ## Particles @@ -552,11 +558,12 @@ Call these functions only at load time! * Convert a Lua table into a JSON string * styled: Outputs in a human-readable format if this is set, defaults to false * Unserializable things like functions and userdata are saved as null. - > [!WARNING] JSON is more strict than the Lua table format. - > 1. You can only use strings and positive integers of at least one as keys. - > 2. You cannot mix string and integer keys. This is due to the fact that JSON has - > two distinct array and object values. * Example: `write_json({10, {a = false}})`, returns `"[10, {\"a\": false}]"` +> [!WARNING] +> JSON is more strict than the Lua table format. +> 1. You can only use strings and positive integers of at least one as keys. +> 2. You cannot mix string and integer keys. This is due to the fact that JSON has +> two distinct array and object values. * `minetest.serialize(table)`: returns a string * Convert a table containing tables, strings, numbers, booleans and `nil`s into string form readable by `minetest.deserialize` diff --git a/doc/lua_api.md b/doc/lua_api.md index a6eec8225c..ad29fea419 100644 --- a/doc/lua_api.md +++ b/doc/lua_api.md @@ -767,7 +767,8 @@ You can use this to send disposable images such as captchas to individual clients, or render things that would be too expensive to compose with `[combine:`. -> [!WARNING] Avoid sending large images this way. This is not a replacement +> [!WARNING] +> Avoid sending large images this way. This is not a replacement for asset files, do not use it to do anything that you could instead achieve by just using a file. In particular consider `minetest.dynamic_add_media` and test whether using other texture modifiers could result in a shorter string @@ -1632,7 +1633,8 @@ The `offset` field specifies a pixel offset from the position. Contrary to position, the offset is not scaled to screen size. This allows for some precisely positioned items in the HUD. -> [!NOTE] `offset` _will_ adapt to screen DPI as well as the user defined scaling factor! +> [!NOTE] +> `offset` _will_ adapt to screen DPI as well as the user defined scaling factor! The `z_index` field specifies the order of HUD elements from back to front. Lower z-index elements are displayed behind higher z-index elements. Elements @@ -2549,10 +2551,12 @@ For colored text you can use `minetest.colorize`. Since formspec version 3, elements drawn in the order they are defined. All background elements are drawn before all other elements. -> [!WARNING] Do _not_ use an element name starting with `key_`; those names are +> [!WARNING] +> Do _not_ use an element name starting with `key_`; those names are reserved to pass key press events to formspec! -> [!WARNING] Minetest allows you to add elements to every single formspec instance +> [!WARNING] +> Minetest allows you to add elements to every single formspec instance using `player:set_formspec_prepend`, which may be the reason backgrounds are appearing when you don't expect them to, or why things are styled differently to normal. See [`no_prepend[]`] and [Styling Formspecs]. @@ -2662,7 +2666,8 @@ background elements are drawn before all other elements. ### `real_coordinates[]` -> [!NOTE] Enable it automatically using formspec version 2 or higher. +> [!NOTE] +> Enable it automatically using formspec version 2 or higher. * When set to true, all following formspec elements will use the new coordinate system. * If used immediately after `size`, `position`, `anchor`, and `no_prepend` elements (if present), the form size will use the new coordinate system. @@ -2717,9 +2722,10 @@ background elements are drawn before all other elements. Indices start at `0`. Default is `0`. * The number of shown slots is the minimum of `W*H` and the inventory list's size minus `starting item index`. - > [!NOTE] With the new coordinate system, the spacing between inventory slots is 1/4 the - size of an inventory slot by default. Also see [Styling Formspecs] for changing the - size of slots and spacing. +> [!NOTE] +> With the new coordinate system, the spacing between inventory slots is 1/4 the + size of an inventory slot by default. Also see [Styling Formspecs] for changing the + size of slots and spacing. ### `listring[;]` @@ -2868,7 +2874,8 @@ background elements are drawn before all other elements. * `default` is the default value of the field * `default` may contain variable references such as `${text}` which will fill the value from the metadata value `text` - > [!NOTE] No extra text or more than a single variable is supported at the moment. +> [!NOTE] +> No extra text or more than a single variable is supported at the moment. * See `field_close_on_enter` to stop enter closing the formspec ### `field[;