]> git.lizzy.rs Git - hydra-dragonfire.git/blob - doc/api.md
Add documentation
[hydra-dragonfire.git] / doc / api.md
1 # Hydra API documentation
2
3 ## Lua version
4 Hydra uses gopher-lua, Lua 5.1
5
6 ## Globals
7
8 - `arg`: table containing command line arguments
9 - `hydra`: contains minetest protocol API, see [hydra.md](hydra.md)
10 - `vec2`, `vec3`, `box`: vector library, see [vector.md](vector.md)
11
12 ## Additional packages
13
14 `require()` can be used to import these modules.
15
16 - `escapes`: contains utility functions to deal with minetest escape sequences, see [escapes.md](escapes.md)
17 - `client`: a function to create a client from command line arguments in the form `<server> <username> <password>`. This is trivial but so commonly used that this function was added to avoid repetition in scripts.
18
19 ## Standard library additions
20
21 Source: [builtin/luax](../bultin/luax).
22
23 - `table.indexof(list, val)`
24 - `table.copy(t, seen)`
25 - `table.insert_all(t, other)`
26 - `table.key_value_swap(t)`
27 - `table.shuffle(t, from, to, random)`
28 - `string.split(str, delim, include_empty, max_splits, sep_is_pattern)`
29 - `string.trim(str)`
30 - `math.hypot(x, y)`
31 - `math.sign(x, tolerance)`
32 - `math.factorial(x)`
33 - `math.round(x)`
34 - `math.clamp(min, max, v)`