]> git.lizzy.rs Git - minetest.git/blob - src/script/lua_api/l_metadata.h
Pass clang-format on 14 trivial header files fixes
[minetest.git] / src / script / lua_api / l_metadata.h
1 /*
2 Minetest
3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
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.
9
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.
14
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.
18 */
19 #ifndef L_METADATA_H_
20 #define L_METADATA_H_
21
22 #include "irrlichttypes_bloated.h"
23 #include "lua_api/l_base.h"
24
25 class Metadata;
26
27 /*
28         NodeMetaRef
29 */
30
31 class MetaDataRef : public ModApiBase
32 {
33 public:
34         virtual ~MetaDataRef() {}
35 protected:
36         static MetaDataRef *checkobject(lua_State *L, int narg);
37
38         virtual void reportMetadataChange() {}
39         virtual Metadata *getmeta(bool auto_create) = 0;
40         virtual void clearMeta() = 0;
41
42         virtual void handleToTable(lua_State *L, Metadata *meta);
43         virtual bool handleFromTable(lua_State *L, int table, Metadata *meta);
44
45         // Exported functions
46
47         // get_string(self, name)
48         static int l_get_string(lua_State *L);
49
50         // set_string(self, name, var)
51         static int l_set_string(lua_State *L);
52
53         // get_int(self, name)
54         static int l_get_int(lua_State *L);
55
56         // set_int(self, name, var)
57         static int l_set_int(lua_State *L);
58
59         // get_float(self, name)
60         static int l_get_float(lua_State *L);
61
62         // set_float(self, name, var)
63         static int l_set_float(lua_State *L);
64
65         // to_table(self)
66         static int l_to_table(lua_State *L);
67
68         // from_table(self, table)
69         static int l_from_table(lua_State *L);
70 };
71
72 #endif /* L_NODEMETA_H_ */