move pack library docs to libpack.md
This commit is contained in:
parent
59c4e26eda
commit
917f47542f
@ -14,6 +14,7 @@ Subsections:
|
||||
- [entities](scripting/builtins/libentities.md)
|
||||
- [cameras](scripting/builtins/libcameras.md)
|
||||
- [mat4](scripting/builtins/libmat4.md)
|
||||
- [pack](scripting/builtins/libpack.md)
|
||||
- [player](scripting/builtins/libplayer.md)
|
||||
- [quat](scripting/builtins/libquat.md)
|
||||
- [vec2, vec3, vec4](scripting/builtins/libvecn.md)
|
||||
@ -40,112 +41,14 @@ require "packid:module_name" -- load Lua module from pack-folder/modules/
|
||||
-- no extension included, just name
|
||||
```
|
||||
|
||||
## *pack* library
|
||||
|
||||
```python
|
||||
pack.is_installed(packid: str) -> bool
|
||||
```
|
||||
|
||||
Check if specified pack is installed in the world
|
||||
|
||||
```lua
|
||||
pack.data_file(packid: str, filename: str) -> str
|
||||
-- and
|
||||
pack.shared_file(packid: str, filename: str) -> str
|
||||
```
|
||||
|
||||
Returns the path to the data file
|
||||
and creates missing directories in the path.
|
||||
|
||||
- The first option returns: `world:data/packid/filename`
|
||||
- The second option returns: `config:packid/filename`
|
||||
|
||||
Examples:
|
||||
```lua
|
||||
file.write(pack.data_file(PACK_ID, "example.txt"), text)
|
||||
```
|
||||
For a *containermod* pack, write text to `world:data/containermod/example.txt`.
|
||||
|
||||
Use this to store in-world data.
|
||||
|
||||
```lua
|
||||
file.write(pack.shared_file(PACK_ID, "example.txt"), text)
|
||||
```
|
||||
For a *containermod* pack, write text to `config:containermod/example.txt`
|
||||
|
||||
Use this to store shared data for all worlds.
|
||||
|
||||
```python
|
||||
pack.get_folder(packid: str) -> str
|
||||
```
|
||||
|
||||
Returns the path to the folder of the installed content pack.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
file.write(pack.data_file(PACK_ID, "example.txt"), text)
|
||||
```
|
||||
|
||||
For pack *containermod* will write text to the file `world:data/containermod/example.txt`
|
||||
|
||||
```python
|
||||
pack.get_folder(packid: str) -> str
|
||||
```
|
||||
|
||||
Returns installed content-pack folder.
|
||||
|
||||
```python
|
||||
pack.is_installed(packid: str) -> bool
|
||||
```
|
||||
|
||||
Check if the world has specified pack installed.
|
||||
|
||||
```python
|
||||
pack.get_installed() -> strings array
|
||||
```
|
||||
|
||||
Returns all installed content-pack ids.
|
||||
|
||||
```python
|
||||
pack.get_available() -> strings array
|
||||
```
|
||||
|
||||
Returns the ids of all content packs available but not installed in the world.
|
||||
|
||||
```python
|
||||
pack.get_base_packs() -> strings array
|
||||
```
|
||||
|
||||
Returns the id of all base packages (non-removeable)
|
||||
|
||||
```python
|
||||
pack.get_info(packid: str) -> {
|
||||
id: str,
|
||||
title: str,
|
||||
creator: str,
|
||||
description: str,
|
||||
version: str,
|
||||
icon: str,
|
||||
dependencies: optional strings array
|
||||
}
|
||||
```
|
||||
|
||||
Returns information about the pack (not necessarily installed).
|
||||
- icon - name of the preview texture (loading automatically)
|
||||
- dependencies - strings following format `{lvl}{id}`, where lvl:
|
||||
- `!` - required
|
||||
- `?` - optional
|
||||
- `~` - weak
|
||||
for example `!teal`
|
||||
|
||||
## *world* library
|
||||
|
||||
## Библиотека *world*
|
||||
|
||||
```python
|
||||
world.get_list() -> tables array {
|
||||
name: str,
|
||||
icon: str
|
||||
name: str,
|
||||
icon: str
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
97
doc/en/scripting/builtins/libpack.md
Normal file
97
doc/en/scripting/builtins/libpack.md
Normal file
@ -0,0 +1,97 @@
|
||||
# *pack* library
|
||||
|
||||
```python
|
||||
pack.is_installed(packid: str) -> bool
|
||||
```
|
||||
|
||||
Check if specified pack is installed in the world
|
||||
|
||||
```lua
|
||||
pack.data_file(packid: str, filename: str) -> str
|
||||
-- and
|
||||
pack.shared_file(packid: str, filename: str) -> str
|
||||
```
|
||||
|
||||
Returns the path to the data file
|
||||
and creates missing directories in the path.
|
||||
|
||||
- The first option returns: `world:data/packid/filename`
|
||||
- The second option returns: `config:packid/filename`
|
||||
|
||||
Examples:
|
||||
```lua
|
||||
file.write(pack.data_file(PACK_ID, "example.txt"), text)
|
||||
```
|
||||
For a *containermod* pack, write text to `world:data/containermod/example.txt`.
|
||||
|
||||
Use this to store in-world data.
|
||||
|
||||
```lua
|
||||
file.write(pack.shared_file(PACK_ID, "example.txt"), text)
|
||||
```
|
||||
For a *containermod* pack, write text to `config:containermod/example.txt`
|
||||
|
||||
Use this to store shared data for all worlds.
|
||||
|
||||
```python
|
||||
pack.get_folder(packid: str) -> str
|
||||
```
|
||||
|
||||
Returns the path to the folder of the installed content pack.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
file.write(pack.data_file(PACK_ID, "example.txt"), text)
|
||||
```
|
||||
|
||||
For pack *containermod* will write text to the file `world:data/containermod/example.txt`
|
||||
|
||||
```python
|
||||
pack.get_folder(packid: str) -> str
|
||||
```
|
||||
|
||||
Returns installed content-pack folder.
|
||||
|
||||
```python
|
||||
pack.is_installed(packid: str) -> bool
|
||||
```
|
||||
|
||||
Check if the world has specified pack installed.
|
||||
|
||||
```python
|
||||
pack.get_installed() -> strings array
|
||||
```
|
||||
|
||||
Returns all installed content-pack ids.
|
||||
|
||||
```python
|
||||
pack.get_available() -> strings array
|
||||
```
|
||||
|
||||
Returns the ids of all content packs available but not installed in the world.
|
||||
|
||||
```python
|
||||
pack.get_base_packs() -> strings array
|
||||
```
|
||||
|
||||
Returns the id of all base packages (non-removeable)
|
||||
|
||||
```python
|
||||
pack.get_info(packid: str) -> {
|
||||
id: str,
|
||||
title: str,
|
||||
creator: str,
|
||||
description: str,
|
||||
version: str,
|
||||
icon: str,
|
||||
dependencies: optional strings array
|
||||
}
|
||||
```
|
||||
|
||||
Returns information about the pack (not necessarily installed).
|
||||
- icon - name of the preview texture (loading automatically)
|
||||
- dependencies - strings following format `{lvl}{id}`, where lvl:
|
||||
- `!` - required
|
||||
- `?` - optional
|
||||
- `~` - weak
|
||||
for example `!teal`
|
||||
@ -12,10 +12,11 @@
|
||||
- [block](scripting/builtins/libblock.md)
|
||||
- [item](scripting/builtins/libitem.md)
|
||||
- [entities](scripting/builtins/libentities.md)
|
||||
- [cameras](scripting/builtins/libcameras.md)
|
||||
- [cameras](scripting/builtins/libcameras.md)
|
||||
- [mat4](scripting/builtins/libmat4.md)
|
||||
- [pack](scripting/builtins/libpack.md)
|
||||
- [player](scripting/builtins/libplayer.md)
|
||||
- [quat](scripting/builtins/libquat.md)
|
||||
- [quat](scripting/builtins/libquat.md)
|
||||
- [vec2, vec3, vec4](scripting/builtins/libvecn.md)
|
||||
- [Модуль core:bit_converter](scripting/modules/core_bit_converter.md)
|
||||
- [Модуль core:data_buffer](scripting/modules/core_data_buffer.md)
|
||||
@ -37,97 +38,12 @@
|
||||
require "контентпак:имя_модуля" -- загружает lua модуль из папки modules (расширение не указывается)
|
||||
```
|
||||
|
||||
## Библиотека *pack*
|
||||
|
||||
```python
|
||||
pack.is_installed(packid: str) -> bool
|
||||
```
|
||||
|
||||
Проверяет наличие установленного пака в мире
|
||||
|
||||
```lua
|
||||
pack.data_file(packid: str, filename: str) -> str
|
||||
-- и
|
||||
pack.shared_file(packid: str, filename: str) -> str
|
||||
```
|
||||
|
||||
Возвращает путь к файлу данных
|
||||
и создает недостающие директории в пути.
|
||||
|
||||
- Первый вариант возвращает: `world:data/packid/filename`
|
||||
- Второй вариант возвращает: `config:packid/filename`
|
||||
|
||||
Примеры:
|
||||
```lua
|
||||
file.write(pack.data_file(PACK_ID, "example.txt"), text)
|
||||
```
|
||||
Для пака *containermod* запишет текст в файл `world:data/containermod/example.txt`.
|
||||
|
||||
Используйте для хранения данных в мире.
|
||||
|
||||
```lua
|
||||
file.write(pack.shared_file(PACK_ID, "example.txt"), text)
|
||||
```
|
||||
Для пака *containermod* запишет текст в файл `config:containermod/example.txt`
|
||||
|
||||
Используйте для хранения данныхm общих для всех миров.
|
||||
|
||||
```python
|
||||
pack.get_folder(packid: str) -> str
|
||||
```
|
||||
|
||||
Возвращает путь к папке установленного контент-пака.
|
||||
|
||||
```python
|
||||
pack.is_installed(packid: str) -> bool
|
||||
```
|
||||
|
||||
Проверяет наличие контент-пака в мире
|
||||
|
||||
```python
|
||||
pack.get_installed() -> массив строк
|
||||
```
|
||||
|
||||
Возращает id всех установленных в мире контент-паков.
|
||||
|
||||
```python
|
||||
pack.get_available() -> массив строк
|
||||
```
|
||||
|
||||
Возвращает id всех доступных, но не установленных в мире контент-паков.
|
||||
|
||||
```python
|
||||
pack.get_base_packs() -> массив строк
|
||||
```
|
||||
|
||||
Возвращает id всех базовых паков (неудаляемых)
|
||||
|
||||
```python
|
||||
pack.get_info(packid: str) -> {
|
||||
id: str,
|
||||
title: str,
|
||||
creator: str,
|
||||
description: str,
|
||||
version: str,
|
||||
icon: str,
|
||||
dependencies: опциональный массив строк
|
||||
}
|
||||
```
|
||||
|
||||
Возвращает информацию о паке (не обязательно установленном).
|
||||
- icon - название текстуры предпросмотра (загружается автоматически)
|
||||
- dependencies - строки в формате `{lvl}{id}`, где lvl:
|
||||
- `!` - required
|
||||
- `?` - optional
|
||||
- `~` - weak
|
||||
например `!teal`
|
||||
|
||||
## Библиотека *world*
|
||||
|
||||
```python
|
||||
world.get_list() -> массив таблиц {
|
||||
name: str,
|
||||
icon: str
|
||||
name: str,
|
||||
icon: str
|
||||
}
|
||||
```
|
||||
|
||||
@ -220,7 +136,7 @@ gui.get_env(document: str) -> table
|
||||
get_locales_info() -> таблица таблиц где
|
||||
ключ - id локали в формате isolangcode_ISOCOUNTRYCODE
|
||||
значение - таблица {
|
||||
name: str # название локали на её языке
|
||||
name: str # название локали на её языке
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
84
doc/ru/scripting/builtins/libpack.md
Normal file
84
doc/ru/scripting/builtins/libpack.md
Normal file
@ -0,0 +1,84 @@
|
||||
# Библиотека *pack*
|
||||
|
||||
```python
|
||||
pack.is_installed(packid: str) -> bool
|
||||
```
|
||||
|
||||
Проверяет наличие установленного пака в мире
|
||||
|
||||
```lua
|
||||
pack.data_file(packid: str, filename: str) -> str
|
||||
-- и
|
||||
pack.shared_file(packid: str, filename: str) -> str
|
||||
```
|
||||
|
||||
Возвращает путь к файлу данных
|
||||
и создает недостающие директории в пути.
|
||||
|
||||
- Первый вариант возвращает: `world:data/packid/filename`
|
||||
- Второй вариант возвращает: `config:packid/filename`
|
||||
|
||||
Примеры:
|
||||
```lua
|
||||
file.write(pack.data_file(PACK_ID, "example.txt"), text)
|
||||
```
|
||||
Для пака *containermod* запишет текст в файл `world:data/containermod/example.txt`.
|
||||
|
||||
Используйте для хранения данных в мире.
|
||||
|
||||
```lua
|
||||
file.write(pack.shared_file(PACK_ID, "example.txt"), text)
|
||||
```
|
||||
Для пака *containermod* запишет текст в файл `config:containermod/example.txt`
|
||||
|
||||
Используйте для хранения данныхm общих для всех миров.
|
||||
|
||||
```python
|
||||
pack.get_folder(packid: str) -> str
|
||||
```
|
||||
|
||||
Возвращает путь к папке установленного контент-пака.
|
||||
|
||||
```python
|
||||
pack.is_installed(packid: str) -> bool
|
||||
```
|
||||
|
||||
Проверяет наличие контент-пака в мире
|
||||
|
||||
```python
|
||||
pack.get_installed() -> массив строк
|
||||
```
|
||||
|
||||
Возращает id всех установленных в мире контент-паков.
|
||||
|
||||
```python
|
||||
pack.get_available() -> массив строк
|
||||
```
|
||||
|
||||
Возвращает id всех доступных, но не установленных в мире контент-паков.
|
||||
|
||||
```python
|
||||
pack.get_base_packs() -> массив строк
|
||||
```
|
||||
|
||||
Возвращает id всех базовых паков (неудаляемых)
|
||||
|
||||
```python
|
||||
pack.get_info(packid: str) -> {
|
||||
id: str,
|
||||
title: str,
|
||||
creator: str,
|
||||
description: str,
|
||||
version: str,
|
||||
icon: str,
|
||||
dependencies: опциональный массив строк
|
||||
}
|
||||
```
|
||||
|
||||
Возвращает информацию о паке (не обязательно установленном).
|
||||
- icon - название текстуры предпросмотра (загружается автоматически)
|
||||
- dependencies - строки в формате `{lvl}{id}`, где lvl:
|
||||
- `!` - required
|
||||
- `?` - optional
|
||||
- `~` - weak
|
||||
например `!teal`
|
||||
Loading…
x
Reference in New Issue
Block a user