summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_nodemeta.h
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
committerShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
commitcaecdb681c428c1aab9c0f7eec2570c0460f995c (patch)
treee5115982ea59bbf2343ba9b35bc4a0cfbb56f407 /src/script/lua_api/l_nodemeta.h
parent81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (diff)
parent80dc961d24e1964e25d57039ddb2ba639f9f4d22 (diff)
downloadminetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.gz
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.bz2
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.zip
Merge 0.4.16 into stable-0.4
Diffstat (limited to 'src/script/lua_api/l_nodemeta.h')
-rw-r--r--src/script/lua_api/l_nodemeta.h48
1 files changed, 21 insertions, 27 deletions
diff --git a/src/script/lua_api/l_nodemeta.h b/src/script/lua_api/l_nodemeta.h
index e39ac3931..dd4260ff9 100644
--- a/src/script/lua_api/l_nodemeta.h
+++ b/src/script/lua_api/l_nodemeta.h
@@ -20,7 +20,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define L_NODEMETA_H_
#include "lua_api/l_base.h"
+#include "lua_api/l_metadata.h"
#include "irrlichttypes_bloated.h"
+#include "nodemetadata.h"
class ServerEnvironment;
class NodeMetadata;
@@ -29,13 +31,16 @@ class NodeMetadata;
NodeMetaRef
*/
-class NodeMetaRef : public ModApiBase {
+class NodeMetaRef : public MetaDataRef {
private:
v3s16 m_p;
ServerEnvironment *m_env;
+ Metadata *m_meta;
+ bool m_is_local;
static const char className[];
- static const luaL_reg methods[];
+ static const luaL_Reg methodsServer[];
+ static const luaL_Reg methodsClient[];
static NodeMetaRef *checkobject(lua_State *L, int narg);
@@ -52,44 +57,28 @@ private:
* @param auto_create when true, try to create metadata information for the node if it has none.
* @return pointer to a @c NodeMetadata object or @c NULL in case of error.
*/
- static NodeMetadata* getmeta(NodeMetaRef *ref, bool auto_create);
+ virtual Metadata* getmeta(bool auto_create);
+ virtual void clearMeta();
- static void reportMetadataChange(NodeMetaRef *ref);
+ virtual void reportMetadataChange();
+
+ virtual void handleToTable(lua_State *L, Metadata *_meta);
+ virtual bool handleFromTable(lua_State *L, int table, Metadata *_meta);
// Exported functions
// garbage collector
static int gc_object(lua_State *L);
- // get_string(self, name)
- static int l_get_string(lua_State *L);
-
- // set_string(self, name, var)
- static int l_set_string(lua_State *L);
-
- // get_int(self, name)
- static int l_get_int(lua_State *L);
-
- // set_int(self, name, var)
- static int l_set_int(lua_State *L);
-
- // get_float(self, name)
- static int l_get_float(lua_State *L);
-
- // set_float(self, name, var)
- static int l_set_float(lua_State *L);
-
// get_inventory(self)
static int l_get_inventory(lua_State *L);
- // to_table(self)
- static int l_to_table(lua_State *L);
-
- // from_table(self, table)
- static int l_from_table(lua_State *L);
+ // mark_as_private(self, <string> or {<string>, <string>, ...})
+ static int l_mark_as_private(lua_State *L);
public:
NodeMetaRef(v3s16 p, ServerEnvironment *env);
+ NodeMetaRef(Metadata *meta);
~NodeMetaRef();
@@ -97,7 +86,12 @@ public:
// Not callable from Lua; all references are created on the C side.
static void create(lua_State *L, v3s16 p, ServerEnvironment *env);
+ // Client-sided version of the above
+ static void createClient(lua_State *L, Metadata *meta);
+
+ static void RegisterCommon(lua_State *L);
static void Register(lua_State *L);
+ static void RegisterClient(lua_State *L);
};
#endif /* L_NODEMETA_H_ */