mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-22 10:29:47 +00:00
fix docs typos and other trash
This commit is contained in:
parent
9744407599
commit
ef61e28f50
88 changed files with 359 additions and 358 deletions
|
|
@ -7,7 +7,7 @@ The script/test name without the path and extension is available as `app.script`
|
|||
local filename = "script:"..app.script..".lua"
|
||||
```
|
||||
|
||||
Since the control script may not belong to any of the packs, it does not belongs to its own package and has its own global namespace in which all global functions and tables are available, as well as the `app` library.
|
||||
Since the control script may not belong to any of the packs, it does not belong to any package and has its own global namespace in which all global functions and tables are available, as well as the `app` library.
|
||||
|
||||
|
||||
## Common functions
|
||||
|
|
@ -67,7 +67,7 @@ app.reconfig_packs(
|
|||
remove_packs: table
|
||||
)
|
||||
|
||||
-- To remove all packs from the configuration,you can use `pack.get_installed()`:
|
||||
-- To remove all packs from the configuration, you can use `pack.get_installed()`:
|
||||
app.reconfig_packs({}, pack.get_installed())
|
||||
-- In this case, `base` will also be removed from the configuration.
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ block.get_variant(x: int, y: int, z: int) -> int
|
|||
-- Sets the block variant by index
|
||||
block.set_variant(x: int, y: int, z: int, index: int)
|
||||
|
||||
-- Checks if an block has specified tag
|
||||
-- Checks if a block has specified tag
|
||||
block.has_tag(id: int, tag: str) -> bool
|
||||
```
|
||||
|
||||
|
|
@ -150,15 +150,15 @@ block.raycast(start: vec3, dir: vec3, max_distance: number, [optional] dest: tab
|
|||
|
||||
Casts a ray from the start point in the direction of *dir*. Max_distance specifies the maximum ray length.
|
||||
|
||||
Argument `filter` can be used to tell ray what blocks can be skipped(passed through) during ray-casting.
|
||||
To use filter `dest` argument must be filled with some value(can be nil), it's done for backwards compatibility
|
||||
Argument `filter` can be used to tell ray what blocks can be skipped (passed through) during ray-casting.
|
||||
To use filter `dest` argument must be filled with some value (can be nil), it's done for backwards compatibility
|
||||
|
||||
The `include_non_selectable` argument determines whether blocks that cannot be selected by the cursor will be included.
|
||||
Example - `base:water`
|
||||
|
||||
The function returns a table with the results or nil if the ray does not hit any block.
|
||||
|
||||
The result will use the destination table instead of creating a new one if the optional argument specified.
|
||||
The result will use the destination table instead of creating a new one if the optional argument is specified.
|
||||
|
||||
Use `world.raycast(...)` for more detailed configuration.
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ Value characters describe the type and size.
|
|||
byteutil.unpack(format: str, bytes: table|Bytearray) -> ...
|
||||
```
|
||||
|
||||
Extracts values from a byte array based on a format string.
|
||||
Extracts values from a byte array based on a format string.
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ Read whole text file.
|
|||
file.read_bytes(path: str, [optional] usetable) -> array of integers
|
||||
```
|
||||
|
||||
Read file into bytes array. If usetable = false , returns Bytearray instead of table.
|
||||
Read file into bytes array. If usetable = false, returns Bytearray instead of table.
|
||||
|
||||
```lua
|
||||
file.is_writeable(path: str) -> bool
|
||||
|
|
@ -53,7 +53,7 @@ Get file length (bytes) or 0.
|
|||
file.exists(path: str) -> bool
|
||||
```
|
||||
|
||||
Check if file or directory exist.
|
||||
Check if file or directory exists.
|
||||
|
||||
```python
|
||||
file.isfile(path: str) -> bool
|
||||
|
|
@ -83,7 +83,7 @@ Create directories chain. Returns true if new directory created.
|
|||
file.list(path: str) -> array of strings
|
||||
```
|
||||
|
||||
Returns a list of files and directories in the specified.
|
||||
Returns a list of files and directories in the specified directory.
|
||||
|
||||
```python
|
||||
file.list_all_res(path: str) -> array of strings
|
||||
|
|
@ -151,7 +151,7 @@ file.name(path: str) --> str
|
|||
|
||||
Extracts the file name from the path. Example: `world:data/base/config.toml` -> `config.toml`.
|
||||
|
||||
``lua
|
||||
```lua
|
||||
file.stem(path: str) --> str
|
||||
```
|
||||
|
||||
|
|
@ -191,6 +191,6 @@ Removes the entry point (prefix) from the path. Example: `world:data/base/config
|
|||
file.join(directory: str, path: str) --> str
|
||||
```
|
||||
|
||||
Joins the path. Example: `file.join("world:data", "base/config.toml)` -> `world:data/base/config.toml`.
|
||||
Joins the path. Example: `file.join("world:data", "base/config.toml")` -> `world:data/base/config.toml`.
|
||||
|
||||
You should use this function instead of concatenating with `/`, since `prefix:/path` is not valid.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ hud.open_inventory()
|
|||
hud.close_inventory()
|
||||
|
||||
-- Open UI and inventory.
|
||||
-- Throws an exception if has UI layout does not exists.
|
||||
-- Throws an exception if the UI layout does not exist.
|
||||
-- If invid is not specified, a virtual (temporary) inventory is created.
|
||||
-- Returns the invid or id of the virtual inventory.
|
||||
hud.open(
|
||||
|
|
@ -34,12 +34,12 @@ hud.open_block(x: int, y: int, z: int) -> int, str
|
|||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Only one block may be open at same time
|
||||
> Only one block may be open at the same time
|
||||
|
||||
```lua
|
||||
-- Show overlay with layout specified.
|
||||
-- Shows player inventory also if playerinv is true.
|
||||
-- Using `args` you can specify an array of parameter values that will be passed
|
||||
-- Using `args` you can specify an array of parameter values that will be passed
|
||||
-- to on_open of the overlay being shown.
|
||||
hud.show_overlay(layoutid: str, playerinv: bool, [optional] args: table)
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ input.is_pressed(code: str) --> bool
|
|||
|
||||
Checks input activity using a code consisting of:
|
||||
- input type: *key* or *mouse*
|
||||
- input code: [key name](#key names) or mouse button name (left, middle, right)
|
||||
- input code: [key name](../user-input.md#key-names) or mouse button name (left, middle, right)
|
||||
|
||||
Example:
|
||||
```lua
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ inventory.has_data(
|
|||
inventory.size(invid: int) -> int
|
||||
|
||||
-- Add an item to the specified inventory.
|
||||
-- Returns remaining count if could not to add fully.
|
||||
-- Returns remaining count if it could not be added fully.
|
||||
inventory.add(invid: int, itemid: int, count: int) -> int
|
||||
|
||||
-- Returns the index of the first matching slot in the given range.
|
||||
|
|
@ -164,7 +164,7 @@ inventory.get_all_data(
|
|||
slot: int,
|
||||
) -> table | nil
|
||||
|
||||
-- Sets the values of all local item properties.
|
||||
-- Sets the values of all local item properties.
|
||||
inventory.set_all_data(
|
||||
-- inventory id
|
||||
invid: int,
|
||||
|
|
@ -186,8 +186,8 @@ inventory.clone(invid: int) -> int
|
|||
|
||||
-- Move an item from slotA of invA to slotB of invB.
|
||||
-- invA may be the same as invB.
|
||||
-- If slotB will be chosen automatically if argument is not specified.
|
||||
-- The move may be incomplete if the available slot has no enough stack space.
|
||||
-- slotB will be chosen automatically if argument is not specified.
|
||||
-- The move may be incomplete if the available slot does not have enough stack space.
|
||||
inventory.move(invA: int, slotA: int, invB: int, slotB: int)
|
||||
|
||||
-- Moves an item from slotA of inventory invA to a suitable slot(s)
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ mat4.scale(m: matrix, scale: vec3, dst: matrix)
|
|||
The angle of rotation is indicated in degrees.
|
||||
|
||||
```lua
|
||||
-- creates a rotation matrix (angle - rotation angle) along a given axis (axis is an unit vector)
|
||||
-- creates a rotation matrix (angle - rotation angle) along a given axis (axis is a unit vector)
|
||||
mat4.rotate(axis: vec3, angle: number)
|
||||
-- returns the result of applying rotation to matrix m
|
||||
mat4.rotate(m: matrix, axis: vec3, angle: number)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ Returns the ids of all content packs available but not installed in the world.
|
|||
pack.get_base_packs() -> strings array
|
||||
```
|
||||
|
||||
Returns the id of all base packages (non-removeable)
|
||||
Returns the ids of all base packages (non-removable)
|
||||
|
||||
```lua
|
||||
pack.get_info(packid: str) -> {
|
||||
|
|
@ -90,7 +90,7 @@ pack.get_info(packid: str) -> {
|
|||
```
|
||||
|
||||
Returns information about the pack (not necessarily installed).
|
||||
- icon - name of the preview texture (loading automatically)
|
||||
- icon - name of the preview texture (loaded automatically)
|
||||
- dependencies - strings following format `{lvl}{id}`, where lvl:
|
||||
- `!` - required
|
||||
- `?` - optional
|
||||
|
|
@ -98,7 +98,7 @@ Returns information about the pack (not necessarily installed).
|
|||
|
||||
for example `!teal`
|
||||
|
||||
To obtain information about multiple packs, use table of ids to avoid re-scanning:one
|
||||
To obtain information about multiple packs, use table of ids to avoid re-scanning:
|
||||
|
||||
```lua
|
||||
pack.get_info(packids: table) -> {id={...}, id2={...}, ...}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ quat.mul_vec3(a: quat, b: vec3, [optional] dst: vec3) -> vec3
|
|||
|
||||
## Spherical linear interpolation - *quat.slerp(...)*
|
||||
|
||||
The interpolation always take the short path and the rotation is performed at constant speed.
|
||||
The interpolation always takes the short path and the rotation is performed at constant speed.
|
||||
|
||||
```lua
|
||||
-- creates a quaternion as an interpolation between a and b,
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
-- Checks if world is open
|
||||
world.is_open() -> bool
|
||||
|
||||
-- Returns worlds information.
|
||||
-- Returns world information.
|
||||
world.get_list() -> tables array {
|
||||
-- world name
|
||||
name: str,
|
||||
-- world icon/preview (loading automatically)
|
||||
-- world icon/preview (loaded automatically)
|
||||
icon: str
|
||||
-- engine version the world was saved on
|
||||
version: {int, int}
|
||||
|
|
@ -99,7 +99,7 @@ world.raycast(
|
|||
-- id of the block types used for filtering
|
||||
filter_blocks: table<string|number> = nil,
|
||||
-- exclusion filtering mode:
|
||||
-- if true, filter_blocks defines the list Ignored
|
||||
-- if true, filter_blocks defines the list of ignored block types
|
||||
blocks_exclusion: bool = true,
|
||||
-- include blocks with selectable=false
|
||||
nonselect_blocks: bool = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue