You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.9KB

  1. /*
  2. Minetest
  3. Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License along
  13. with this program; if not, write to the Free Software Foundation, Inc.,
  14. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #ifndef L_METADATA_H_
  17. #define L_METADATA_H_
  18. #include "irrlichttypes_bloated.h"
  19. #include "lua_api/l_base.h"
  20. class Metadata;
  21. /*
  22. NodeMetaRef
  23. */
  24. class MetaDataRef : public ModApiBase
  25. {
  26. public:
  27. virtual ~MetaDataRef() {}
  28. protected:
  29. static MetaDataRef *checkobject(lua_State *L, int narg);
  30. virtual void reportMetadataChange() {}
  31. virtual Metadata *getmeta(bool auto_create) = 0;
  32. virtual void clearMeta() = 0;
  33. virtual void handleToTable(lua_State *L, Metadata *meta);
  34. virtual bool handleFromTable(lua_State *L, int table, Metadata *meta);
  35. // Exported functions
  36. // get_string(self, name)
  37. static int l_get_string(lua_State *L);
  38. // set_string(self, name, var)
  39. static int l_set_string(lua_State *L);
  40. // get_int(self, name)
  41. static int l_get_int(lua_State *L);
  42. // set_int(self, name, var)
  43. static int l_set_int(lua_State *L);
  44. // get_float(self, name)
  45. static int l_get_float(lua_State *L);
  46. // set_float(self, name, var)
  47. static int l_set_float(lua_State *L);
  48. // to_table(self)
  49. static int l_to_table(lua_State *L);
  50. // from_table(self, table)
  51. static int l_from_table(lua_State *L);
  52. // equals(self, other)
  53. static int l_equals(lua_State *L);
  54. };
  55. #endif /* L_NODEMETA_H_ */