3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "lua_api/l_base.h"
23 #include "irrlichttypes_bloated.h"
25 class ServerEnvironment;
32 class NodeMetaRef : public ModApiBase {
35 ServerEnvironment *m_env;
37 static const char className[];
38 static const luaL_reg methods[];
40 static NodeMetaRef *checkobject(lua_State *L, int narg);
42 static NodeMetadata* getmeta(NodeMetaRef *ref, bool auto_create);
44 static void reportMetadataChange(NodeMetaRef *ref);
49 static int gc_object(lua_State *L);
51 // get_string(self, name)
52 static int l_get_string(lua_State *L);
54 // set_string(self, name, var)
55 static int l_set_string(lua_State *L);
57 // get_int(self, name)
58 static int l_get_int(lua_State *L);
60 // set_int(self, name, var)
61 static int l_set_int(lua_State *L);
63 // get_float(self, name)
64 static int l_get_float(lua_State *L);
66 // set_float(self, name, var)
67 static int l_set_float(lua_State *L);
69 // get_inventory(self)
70 static int l_get_inventory(lua_State *L);
73 static int l_to_table(lua_State *L);
75 // from_table(self, table)
76 static int l_from_table(lua_State *L);
79 NodeMetaRef(v3s16 p, ServerEnvironment *env);
83 // Creates an NodeMetaRef and leaves it on top of stack
84 // Not callable from Lua; all references are created on the C side.
85 static void create(lua_State *L, v3s16 p, ServerEnvironment *env);
87 static void Register(lua_State *L);
90 #endif /* L_NODEMETA_H_ */