Compare commits

...

2 Commits

Author SHA1 Message Date
908db8e3b0 Add issue template 2026-06-16 21:21:02 +03:00
0489e18385 Update MetaDataRef & readme, rename readme and license 2026-06-16 21:08:22 +03:00
4 changed files with 95 additions and 15 deletions

View File

@@ -0,0 +1,17 @@
name: Update request
about: Report discrepancies between the annotation and documentation and request an update.
title: "Update request: "
labels:
- update request
body:
- type: textarea
id: report-desc
attributes:
label: Description
description: Describe the discrepancy you found and attach a link to the Luanti API Reference.
validations:
required: true
- type: markdown
attributes:
value: |
Thank you for reporting the discrepancy!

View File

@@ -19,6 +19,17 @@ This ide-helper is specifically designed to support the [SMC game](https://git.a
- Any editor with LSP support. - Any editor with LSP support.
Install Lua LS: `cargo install emmylua_ls` (or see [instalation guide](https://github.com/EmmyLuaLs/emmylua-analyzer-rust?tab=readme-ov-file#-installation)) Install Lua LS: `cargo install emmylua_ls` (or see [instalation guide](https://github.com/EmmyLuaLs/emmylua-analyzer-rust?tab=readme-ov-file#-installation))
## Annotation up-to-dateness
Some annotations may be outdated for newer versions of Luanti, as the Luanti API Reference gradually changes.
At the beginning of some files, there may be information about relevance in the form of a Luanti version:
```lua
---Version: 5.16 -- This means that the annotations were updated or verified with the documentation for Luanti 5.16.
---@meta
```
If you find a discrepancy between the ide-helper annotations and the Luanti API Reference, you can create an [issue](https://git.apancore.ru/Apancore.Studio/smc-luanti-ide-helper/issues/new?template=.gitea%2fissue_template%2fupdate_request.yaml) to notify the maintainers.
## License ## License
This project is licensed under the MIT License - see [`license.md`](./license.md) file for details. This project is licensed under the MIT License - see [`license.md`](./license.md) file for details.

View File

@@ -1,3 +1,4 @@
---Version: 5.16
---@meta ---@meta
---Base class used by [`StorageRef`], [`NodeMetaRef`], [`ItemStackMetaRef`], ---Base class used by [`StorageRef`], [`NodeMetaRef`], [`ItemStackMetaRef`],
@@ -74,20 +75,71 @@ function MetaDataRef:get_float(key) end
---@return table ---@return table
function MetaDataRef:get_keys() end function MetaDataRef:get_keys() end
--- returns `nil` or a table with keys: ---Metadata tables represent MetaDataRef in a Lua table form (see `from_table`/`to_table`).
--- * `fields`: key-value storage ---
--- * `inventory`: `{list1 = {}, ...}}` (NodeMetaRef only) ---Example:
--- @return table|nil ---```lua
---metadata_table = {
--- -- metadata fields (key/value store)
--- fields = {
--- infotext = "Container",
--- another_key = "Another Value",
--- },
--- -- inventory data (for nodes)
--- inventory = {
--- -- inventory list "main" with 4 slots
--- main = {
--- -- list of all item slots
--- [1] = ItemStack("example:dirt"),
--- [2] = ItemStack("example:stone 25"),
--- [3] = ItemStack(""), -- empty slot
--- [4] = ItemStack("example:pickaxe"),
--- },
--- -- inventory list "hidden" with 1 slot
--- hidden = {
--- [1] = ItemStack("example:diamond"),
--- },
--- },
---}
---```
---@class MetaDataRef.Table
---Key-value storage of metadata fields.
---
---All values are stored as strings.
---
---Numbers must be converted to strings first.
---@field fields table
---
---(for NodeMetaRef only): A node inventory in table form
---
---Inventory table keys are inventory list names.
---
---Inventory table values are item tables.
---
---Item table keys are slot IDs (starting with 1).
---
---Item table values are ItemStacks
---@field inventory table
---Returns a [metadata table](lua://MetaDataRef.Table) or `nil` on failure.
---@return MetaDataRef.Table?
function MetaDataRef:to_table() end function MetaDataRef:to_table() end
--- * Any non-table value will clear the metadata ---Imports metadata from a [metadata table](lua://MetaDataRef.Table).
--- * See [Node Metadata] for an example ---
--- * returns `true` on success ---If `data` is a metadata table,
--- @param value table|nil ---the metadata it represents will replace all metadata of this MetaDataRef object.
---
---Any non-table value for `data` will clear all metadata.
---
---Item table values the inventory field may also be itemstrings.
---
---Returns `true` on success.
--- @param data MetaDataRef.Table?
--- @return boolean --- @return boolean
function MetaDataRef:from_table(value) end function MetaDataRef:from_table(data) end
--- * returns `true` if this metadata has the same key-value pairs as `other` ---Returns `true` if this metadata has the same key-value pairs as `other`.
---@param other any ---@param other any
---@return boolean ---@return boolean
function MetaDataRef:equals(other) end function MetaDataRef:equals(other) end