add item.caption(...) function & move item library docs to libitem.md

This commit is contained in:
MihailRis
2024-10-15 04:48:01 +03:00
parent 57e397e692
commit 4dfa235f12
6 changed files with 54 additions and 65 deletions
+1 -32
View File
@@ -10,6 +10,7 @@ Subsections:
- [Entities and components](scripting/ecs.md)
- [Libraries](#)
- [block](scripting/builtins/libblock.md)
- [item](scripting/builtins/libitem.md)
- [entities](scripting/builtins/libentities.md)
- [cameras](scripting/builtins/libcameras.md)
- [mat4](scripting/builtins/libmat4.md)
@@ -306,38 +307,6 @@ inventory.move(invA: int, slotA: int, invB: int, slotB: int)
Move item from slotA of invA to slotB of invB. invA may be the same as invB.
If slotB will be chosen automaticly if argument is not specified.
## *item* library
```python
item.name(itemid: int) -> str
```
Returns item string ID (name) by index
```python
item.index(name: str) -> int
```
Returns item integer ID (index) by name
```python
item.stack_size(itemid: int) -> int
```
Returns max stack size for the item
```python
item.defs_count() -> int
```
Returns count of available item IDs.
```python
item.icon(itemid: int) -> str
```
Returns item icon name to use in 'src' property of an image element
## *hud* library
+1 -1
View File
@@ -10,7 +10,7 @@ block.index(name: str) -> int
-- Returns the id of the block material.
block.material(blockid: int) -> str
-- Returns the block name displayed in the UI.
-- Returns the block display name.
block.caption(blockid: int) -> str
-- Returns integer ID by block position
+21
View File
@@ -0,0 +1,21 @@
# *item* library
```lua
-- Returns item string ID (name) by index
item.name(itemid: int) -> str
-- Returns item integer ID (index) by name
item.index(name: str) -> int
-- Returns the item display name.
block.caption(blockid: int) -> str
-- Returns max stack size for the item
item.stack_size(itemid: int) -> int
-- Returns count of available item IDs.
item.defs_count() -> int
-- Returns item icon name to use in 'src' property of an image element
item.icon(itemid: int) -> str
```