]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/script/lua_api/l_item.h
CSM: Bugfixes to camera:get_pos() and camera:get_fov()
[dragonfireclient.git] / src / script / lua_api / l_item.h
index cbed4ae0b99af1bab437ac7ea35b5161c5595fb5..6fab58045774b6de9d4189ad2e9fbaf86889b049 100644 (file)
@@ -17,32 +17,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef L_ITEM_H_
-#define L_ITEM_H_
-
-extern "C" {
-#include <lua.h>
-#include <lauxlib.h>
-}
-
-#include <vector>
-
-#include "itemdef.h"
-#include "content_sao.h"
-#include "util/pointedthing.h"
-#include "inventory.h"
+#pragma once
 
 #include "lua_api/l_base.h"
+#include "inventory.h"  // ItemStack
 
-class ModApiInventory;
-
-class LuaItemStack
-{
+class LuaItemStack : public ModApiBase {
 private:
        ItemStack m_stack;
 
        static const char className[];
-       static const luaL_reg methods[];
+       static const luaL_Reg methods[];
 
        // Exported functions
 
@@ -55,15 +40,35 @@ class LuaItemStack
        // get_name(self) -> string
        static int l_get_name(lua_State *L);
 
+       // set_name(self, name)
+       static int l_set_name(lua_State *L);
+
        // get_count(self) -> number
        static int l_get_count(lua_State *L);
 
+       // set_count(self, number)
+       static int l_set_count(lua_State *L);
+
        // get_wear(self) -> number
        static int l_get_wear(lua_State *L);
 
+       // set_wear(self, number)
+       static int l_set_wear(lua_State *L);
+
+       // get_meta(self) -> string
+       static int l_get_meta(lua_State *L);
+
+       // DEPRECATED
        // get_metadata(self) -> string
        static int l_get_metadata(lua_State *L);
 
+       // DEPRECATED
+       // set_metadata(self, string)
+       static int l_set_metadata(lua_State *L);
+
+       // get_description(self)
+       static int l_get_description(lua_State *L);
+
        // clear(self) -> true
        static int l_clear(lua_State *L);
 
@@ -87,7 +92,7 @@ class LuaItemStack
        static int l_is_known(lua_State *L);
 
        // get_definition(self) -> table
-       // Returns the item definition table from minetest.registered_items,
+       // Returns the item definition table from core.registered_items,
        // or a fallback one (name="unknown")
        static int l_get_definition(lua_State *L);
 
@@ -119,7 +124,7 @@ class LuaItemStack
 
 public:
        LuaItemStack(const ItemStack &item);
-       ~LuaItemStack();
+       ~LuaItemStack() = default;
 
        const ItemStack& getItem() const;
        ItemStack& getItem();
@@ -134,18 +139,13 @@ class LuaItemStack
 
 };
 
-class ModApiItemMod
-       :virtual public ModApiBase
-{
-public:
-       ModApiItemMod();
-
-       bool Initialize(lua_State *L,int top);
-
+class ModApiItemMod : public ModApiBase {
+private:
        static int l_register_item_raw(lua_State *L);
+       static int l_unregister_item_raw(lua_State *L);
        static int l_register_alias_raw(lua_State *L);
+       static int l_get_content_id(lua_State *L);
+       static int l_get_name_from_content_id(lua_State *L);
+public:
+       static void Initialize(lua_State *L, int top);
 };
-
-
-
-#endif /* L_ITEM_H_ */