From 0b5b32b026291d5bd8e47acebca10259a379fc1c Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Mon, 30 Apr 2018 17:42:51 +0100 Subject: MetaDataRef: Add contains() and get() (#7214) --- doc/lua_api.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 321c2abc6..5442612af 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -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) -- cgit v1.2.3