aboutsummaryrefslogtreecommitdiff
path: root/doc/api.md
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-05-30 16:18:00 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-05-30 16:18:00 +0200
commitf19effdf25ed3f09184672a9c6aaf459f81d706a (patch)
tree28773a654f182774139d3debdc18ecdd7dc789f9 /doc/api.md
parent1352a5e8f46b4aeed0eafaf60b5e72ad2f70ba48 (diff)
downloadhydra-dragonfire-f19effdf25ed3f09184672a9c6aaf459f81d706a.tar.xz
Add documentation
Diffstat (limited to 'doc/api.md')
-rw-r--r--doc/api.md34
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/api.md b/doc/api.md
new file mode 100644
index 0000000..13516ec
--- /dev/null
+++ b/doc/api.md
@@ -0,0 +1,34 @@
+# Hydra API documentation
+
+## Lua version
+Hydra uses gopher-lua, Lua 5.1
+
+## Globals
+
+- `arg`: table containing command line arguments
+- `hydra`: contains minetest protocol API, see [hydra.md](hydra.md)
+- `vec2`, `vec3`, `box`: vector library, see [vector.md](vector.md)
+
+## Additional packages
+
+`require()` can be used to import these modules.
+
+- `escapes`: contains utility functions to deal with minetest escape sequences, see [escapes.md](escapes.md)
+- `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.
+
+## Standard library additions
+
+Source: [builtin/luax](../bultin/luax).
+
+- `table.indexof(list, val)`
+- `table.copy(t, seen)`
+- `table.insert_all(t, other)`
+- `table.key_value_swap(t)`
+- `table.shuffle(t, from, to, random)`
+- `string.split(str, delim, include_empty, max_splits, sep_is_pattern)`
+- `string.trim(str)`
+- `math.hypot(x, y)`
+- `math.sign(x, tolerance)`
+- `math.factorial(x)`
+- `math.round(x)`
+- `math.clamp(min, max, v)`