1
0
Fork 0
mirror of https://github.com/dragonfireclient/hydra-dragonfire.git synced 2024-11-22 02:44:01 -05:00
hydra-dragonfire/doc/api.md
Elias Fleckenstein fae336d1a2
Add map component
2022-05-31 14:24:19 +02:00

35 lines
1.2 KiB
Markdown

# 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.
- `base64`: contains the `base64.encode(data)` function to base64 encode a string as well as `base64.decode(data)` to decode
## Standard library additions
Source code: [luax](https://github.com/EliasFleckenstein03/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)`