Minetest  5.4.0
ItemStackMetaRef Class Reference

#include <l_itemstackmeta.h>

+ Inheritance diagram for ItemStackMetaRef:
+ Collaboration diagram for ItemStackMetaRef:

Public Member Functions

 ItemStackMetaRef (ItemStack *istack)
 
 ~ItemStackMetaRef ()=default
 
- Public Member Functions inherited from MetaDataRef
virtual ~MetaDataRef ()=default
 

Static Public Member Functions

static void create (lua_State *L, ItemStack *istack)
 
static void Register (lua_State *L)
 
- Static Public Member Functions inherited from ModApiBase
static ScriptApiBasegetScriptApiBase (lua_State *L)
 
static ServergetServer (lua_State *L)
 
static ServerInventoryManagergetServerInventoryMgr (lua_State *L)
 
static ClientgetClient (lua_State *L)
 
static GUIEnginegetGuiEngine (lua_State *L)
 
static IGameDefgetGameDef (lua_State *L)
 
static EnvironmentgetEnv (lua_State *L)
 
static std::string getCurrentModPath (lua_State *L)
 
template<typename T >
static T * getScriptApi (lua_State *L)
 
static bool registerFunction (lua_State *L, const char *name, lua_CFunction func, int top)
 
static int l_deprecated_function (lua_State *L, const char *good, const char *bad, lua_CFunction func)
 A wrapper for deprecated functions. More...
 

Private Member Functions

virtual Metadatagetmeta (bool auto_create)
 
virtual void clearMeta ()
 
virtual void reportMetadataChange (const std::string *name=nullptr)
 
void setToolCapabilities (const ToolCapabilities &caps)
 
void clearToolCapabilities ()
 

Static Private Member Functions

static ItemStackMetaRefcheckobject (lua_State *L, int narg)
 
static int l_set_tool_capabilities (lua_State *L)
 
static int gc_object (lua_State *L)
 

Private Attributes

ItemStackistack = nullptr
 

Static Private Attributes

static const char className [] = "ItemStackMetaRef"
 
static const luaL_Reg methods []
 

Additional Inherited Members

- Protected Member Functions inherited from MetaDataRef
virtual void handleToTable (lua_State *L, Metadata *meta)
 
virtual bool handleFromTable (lua_State *L, int table, Metadata *meta)
 
- Protected Member Functions inherited from LuaHelper
template<>
bool readParam (lua_State *L, int index)
 
- Static Protected Member Functions inherited from MetaDataRef
static MetaDataRefcheckobject (lua_State *L, int narg)
 
static int l_contains (lua_State *L)
 
static int l_get (lua_State *L)
 
static int l_get_string (lua_State *L)
 
static int l_set_string (lua_State *L)
 
static int l_get_int (lua_State *L)
 
static int l_set_int (lua_State *L)
 
static int l_get_float (lua_State *L)
 
static int l_set_float (lua_State *L)
 
static int l_to_table (lua_State *L)
 
static int l_from_table (lua_State *L)
 
static int l_equals (lua_State *L)
 
- Static Protected Member Functions inherited from LuaHelper
static bool isNaN (lua_State *L, int idx)
 
template<typename T >
static T readParam (lua_State *L, int index)
 Read a value using a template type T from Lua State L and index. More...
 
template<typename T >
static T readParam (lua_State *L, int index, const T &default_value)
 Read a value using a template type T from Lua State L and index. More...
 

Constructor & Destructor Documentation

◆ ItemStackMetaRef()

ItemStackMetaRef::ItemStackMetaRef ( ItemStack istack)
inline

Referenced by create().

+ Here is the caller graph for this function:

◆ ~ItemStackMetaRef()

ItemStackMetaRef::~ItemStackMetaRef ( )
default

Member Function Documentation

◆ checkobject()

ItemStackMetaRef * ItemStackMetaRef::checkobject ( lua_State *  L,
int  narg 
)
staticprivate

References className.

Referenced by l_set_tool_capabilities().

+ Here is the caller graph for this function:

◆ clearMeta()

void ItemStackMetaRef::clearMeta ( )
privatevirtual

Implements MetaDataRef.

References ItemStackMetadata::clear(), istack, and ItemStack::metadata.

+ Here is the call graph for this function:

◆ clearToolCapabilities()

void ItemStackMetaRef::clearToolCapabilities ( )
inlineprivate

References ItemStackMetadata::clearToolCapabilities(), istack, and ItemStack::metadata.

Referenced by l_set_tool_capabilities().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

void ItemStackMetaRef::create ( lua_State *  L,
ItemStack istack 
)
static

References ItemStackMetaRef(), className, and istack.

Referenced by LuaItemStack::l_get_meta().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gc_object()

int ItemStackMetaRef::gc_object ( lua_State *  L)
staticprivate

Referenced by Register().

+ Here is the caller graph for this function:

◆ getmeta()

Metadata * ItemStackMetaRef::getmeta ( bool  auto_create)
privatevirtual

Implements MetaDataRef.

References istack, and ItemStack::metadata.

◆ l_set_tool_capabilities()

int ItemStackMetaRef::l_set_tool_capabilities ( lua_State *  L)
staticprivate

References checkobject(), clearToolCapabilities(), read_tool_capabilities(), and setToolCapabilities().

+ Here is the call graph for this function:

◆ Register()

void ItemStackMetaRef::Register ( lua_State *  L)
static

References className, gc_object(), MetaDataRef::l_equals(), and methods.

Referenced by ClientScripting::InitializeModApi(), and ServerScripting::InitializeModApi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reportMetadataChange()

void ItemStackMetaRef::reportMetadataChange ( const std::string *  name = nullptr)
privatevirtual

Reimplemented from MetaDataRef.

◆ setToolCapabilities()

void ItemStackMetaRef::setToolCapabilities ( const ToolCapabilities caps)
inlineprivate

References istack, ItemStack::metadata, and ItemStackMetadata::setToolCapabilities().

Referenced by l_set_tool_capabilities().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ className

const char ItemStackMetaRef::className = "ItemStackMetaRef"
staticprivate

Referenced by checkobject(), create(), and Register().

◆ istack

ItemStack* ItemStackMetaRef::istack = nullptr
private

◆ methods

const luaL_Reg ItemStackMetaRef::methods
staticprivate
Initial value:
= {
luamethod(MetaDataRef, contains),
luamethod(MetaDataRef, get_string),
luamethod(MetaDataRef, set_string),
luamethod(MetaDataRef, get_float),
luamethod(MetaDataRef, set_float),
luamethod(MetaDataRef, to_table),
luamethod(MetaDataRef, from_table),
luamethod(ItemStackMetaRef, set_tool_capabilities),
{0,0}
}
Definition: l_itemstackmeta.h:30
Definition: l_metadata.h:33
#define luamethod(class, name)
Definition: l_internal.h:31

Referenced by Register().


The documentation for this class was generated from the following files: