mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
MetaDataRef: Add contains() and get() (#7214)
This commit is contained in:
parent
54606e103d
commit
0b5b32b026
8 changed files with 72 additions and 6 deletions
|
@ -3909,12 +3909,15 @@ An interface to use mod channels on client and server
|
|||
See `StorageRef`, `NodeMetaRef`, `ItemStackMetaRef`, and `PlayerMetaRef`.
|
||||
|
||||
#### Methods
|
||||
* `set_string(name, value)`
|
||||
* `get_string(name)`
|
||||
* `set_int(name, value)`
|
||||
* `get_int(name)`
|
||||
* `set_float(name, value)`
|
||||
* `get_float(name)`
|
||||
* `contains(key)`: Returns true if key present, otherwise false.
|
||||
* Returns `nil` when the MetaData is inexistent.
|
||||
* `get(key)`: Returns `nil` if key not present, else the stored string.
|
||||
* `set_string(key, value)`: Value of `""` will delete the key.
|
||||
* `get_string(key)`: Returns `""` if key not present.
|
||||
* `set_int(key, value)`
|
||||
* `get_int(key)`: Returns `0` if key not present.
|
||||
* `set_float(key, value)`
|
||||
* `get_float(key)`: Returns `0` if key not present.
|
||||
* `to_table()`: returns `nil` or a table with keys:
|
||||
* `fields`: key-value storage
|
||||
* `inventory`: `{list1 = {}, ...}}` (NodeMetaRef only)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue