1
0
Fork 0
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:
rubenwardy 2018-04-30 17:42:51 +01:00 committed by SmallJoker
parent 54606e103d
commit 0b5b32b026
8 changed files with 72 additions and 6 deletions

View file

@ -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)