mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-21 18:09:46 +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;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ entity:require_component(name: str) -> component
|
|||
-- Enables/disables the component
|
||||
entity:set_enabled(name: str, enable: bool)
|
||||
|
||||
-- Returns id of player the entity is bound, otherwise -1 is returned.
|
||||
-- Returns id of player the entity is bound to, otherwise -1 is returned.
|
||||
-- At components initialization -1 is also returned,
|
||||
-- since the binding occurs after initialization.
|
||||
entity:get_player() -> int or nil
|
||||
|
|
@ -240,7 +240,7 @@ Called before component data is saved. Here you can write the data you want to s
|
|||
function on_update(tps: int)
|
||||
```
|
||||
|
||||
Called every entities tick (currently 20 times per second).
|
||||
Called every entity tick (currently 20 times per second).
|
||||
|
||||
```lua
|
||||
function on_physics_update(delta: number)
|
||||
|
|
@ -289,7 +289,7 @@ Called when an entity is attacked (LMB on the entity). The first argument is the
|
|||
function on_used(playerid: int)
|
||||
```
|
||||
|
||||
Called when an entity is used (RMB by entity). The player ID is passed as an argument.
|
||||
Called when an entity is used (RMB on the entity). The player ID is passed as an argument.
|
||||
|
||||
```lua
|
||||
function on_player_set(playerid: int)
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ table.index(t: table, x: any) -> int
|
|||
-- Removes element x from t.
|
||||
table.remove_value(t: table, x: any)
|
||||
|
||||
-- Shuffles values in the table.
|
||||
-- Shuffles values in the table.
|
||||
table.shuffle(t: table) -> table
|
||||
|
||||
-- Adds values from table t2 to table t1. If table t2 contains a key from t1, the key's value will not be changed.
|
||||
-- Adds values from table t2 to table t1. If table t2 contains a key from t1, the key's value will not be changed.
|
||||
table.merge(t1: table, t2: table) -> table
|
||||
|
||||
-- Iterates through the table and applies a func to all its elements, returning the new value of the element.
|
||||
|
|
@ -180,7 +180,7 @@ math.sum(x: number, ... | t: table) -> number
|
|||
bit.compile(expr: string, args: table | nil, asFunction: boolean=true) -> function | string
|
||||
|
||||
-- Compiles the function to perform bitwise operations and executes it in place
|
||||
-- * ...: Values to be passed to the compiled function. bit.execute(expr: string, args: table | nil, ...) -> number
|
||||
-- * ...: Values to be passed to the compiled function. bit.execute(expr: string, args: table | nil, ...) -> number
|
||||
```
|
||||
## Additional Global Functions
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ parse_path(path: string) -> string, string
|
|||
sleep(timesec: number)
|
||||
|
||||
-- Waits for the passed coroutine to complete, returning the control flow. The function can only be used inside a coroutine.
|
||||
-- Returns values similar to those returned by pcall.
|
||||
-- Returns values similar to those returned by pcall.
|
||||
await(co: coroutine) -> result, error
|
||||
|
||||
-- A constant storing the PID of the current engine instance.
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ The library contains functions for serializing and deserializing XML:
|
|||
|
||||
Further, XML as a data type denotes a Lua table with the following structure:
|
||||
- Element tag is accessible by the key `#`
|
||||
- XML attributes are accessible as key = value pairs
|
||||
- XML attributes are accessible as key = value pairs
|
||||
- Inner elements are accessible by index
|
||||
|
||||
The table is used both as a dictionary and an array.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Module core:bit_converter
|
||||
|
||||
## Converting values to bytes and back
|
||||
## Converting values to bytes and back
|
||||
|
||||
```lua
|
||||
function bit_converter.string_to_bytes(string: str) -> table
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ local worldsPanel = document["worlds-panel"]
|
|||
print(worldsPanel.pos)
|
||||
```
|
||||
|
||||
The IDs of the elements are global for the document, that is, *worlds-panel* can be located either in the root element,
|
||||
and in a nested container.
|
||||
The IDs of the elements are global for the document, that is, *worlds-panel* can be located either in the root element
|
||||
or in a nested container.
|
||||
|
||||
The element id cannot be changed from a script.
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ Here, *color* can be specified in the following ways:
|
|||
| data:unbind_texture() | unbinds the texture from the canvas |
|
||||
| data:mul(*color* or Canvas) | multiplies a color by the specified color or canvas |
|
||||
| data:add(*color* or Canvas) | adds a color or another canvas to a color |
|
||||
| data:sub(*color* or Canvas) | subtracts a color or another canvas to a color |
|
||||
| data:sub(*color* or Canvas) | subtracts a color or another canvas from a color |
|
||||
| data:encode(format: str) | encodes image to specified format and returns bytearray |
|
||||
|
||||
To decode a byte array into a Canvas, use the static method:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue