Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
ItemStackMetaRef Class Reference

#include <l_itemstackmeta.h>

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

Public Member Functions

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

Static Public Member Functions

static void create (lua_State *L, LuaItemStack *istack)
 
static void Register (lua_State *L)
 
- Static Public Member Functions inherited from MetaDataRef
static MetaDataRefcheckAnyMetadata (lua_State *L, int narg)
 
- Static Public Member Functions inherited from ModApiBase
static ScriptApiBasegetScriptApiBase (lua_State *L)
 
static ServergetServer (lua_State *L)
 
static ServerInventoryManagergetServerInventoryMgr (lua_State *L)
 
static EmergeThreadgetEmergeThread (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 void registerClass (lua_State *L, const char *name, const luaL_Reg *methods, const luaL_Reg *metamethods)
 
template<typename T >
static T * checkObject (lua_State *L, int narg)
 
static int l_deprecated_function (lua_State *L, const char *good, const char *bad, lua_CFunction func)
 A wrapper for deprecated functions.
 

Static Public Attributes

static const char className [] = "ItemStackMetaRef"
 

Private Member Functions

virtual IMetadatagetmeta (bool auto_create)
 
virtual void clearMeta ()
 
virtual void reportMetadataChange (const std::string *name=nullptr)
 
void setToolCapabilities (const ToolCapabilities &caps)
 
void clearToolCapabilities ()
 
void setWearBarParams (const WearBarParams &params)
 
void clearWearBarParams ()
 

Static Private Member Functions

static int l_set_tool_capabilities (lua_State *L)
 
static int l_set_wear_bar_params (lua_State *L)
 

Private Attributes

LuaItemStackistack
 

Static Private Attributes

static const luaL_Reg methods []
 

Additional Inherited Members

- Protected Member Functions inherited from MetaDataRef
virtual void handleToTable (lua_State *L, IMetadata *meta)
 
virtual bool handleFromTable (lua_State *L, int table, IMetadata *meta)
 
- Protected Member Functions inherited from LuaHelper
template<>
bool readParam (lua_State *L, int index)
 
template<>
s16 readParam (lua_State *L, int index)
 
template<>
int readParam (lua_State *L, int index)
 
template<>
float readParam (lua_State *L, int index)
 
template<>
v2s16 readParam (lua_State *L, int index)
 
template<>
v2f readParam (lua_State *L, int index)
 
template<>
v3f readParam (lua_State *L, int index)
 
template<>
std::string_view readParam (lua_State *L, int index)
 
template<>
std::string readParam (lua_State *L, int index)
 
template<>
std::string_view readParam (lua_State *L, int index)
 Read a string from Lua state L at index without copying it.
 
- Static Protected Member Functions inherited from MetaDataRef
static void registerMetadataClass (lua_State *L, const char *name, const luaL_Reg *methods)
 
static int gc_object (lua_State *L)
 
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_get_keys (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
template<typename T >
static T readParam (lua_State *L, int index)
 Read a value using a template type T from Lua state L at index.
 
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 at index.
 

Constructor & Destructor Documentation

◆ ItemStackMetaRef()

ItemStackMetaRef::ItemStackMetaRef ( LuaItemStack * istack)

References IntrusiveReferenceCounted::grab(), and istack.

Referenced by create().

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

◆ ~ItemStackMetaRef()

ItemStackMetaRef::~ItemStackMetaRef ( )

References IntrusiveReferenceCounted::drop(), and istack.

+ Here is the call graph for this function:

Member Function Documentation

◆ clearMeta()

void ItemStackMetaRef::clearMeta ( )
privatevirtual

Implements MetaDataRef.

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

+ Here is the call graph for this function:

◆ clearToolCapabilities()

void ItemStackMetaRef::clearToolCapabilities ( )
inlineprivate

References ItemStackMetadata::clearToolCapabilities(), LuaItemStack::getItem(), 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:

◆ clearWearBarParams()

void ItemStackMetaRef::clearWearBarParams ( )
inlineprivate

References ItemStackMetadata::clearWearBarParams(), LuaItemStack::getItem(), istack, and ItemStack::metadata.

Referenced by l_set_wear_bar_params().

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

◆ create()

void ItemStackMetaRef::create ( lua_State * L,
LuaItemStack * 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:

◆ getmeta()

IMetadata * ItemStackMetaRef::getmeta ( bool auto_create)
privatevirtual

Implements MetaDataRef.

References LuaItemStack::getItem(), istack, and ItemStack::metadata.

+ Here is the call graph for this function:

◆ l_set_tool_capabilities()

int ItemStackMetaRef::l_set_tool_capabilities ( lua_State * L)
staticprivate

References ModApiBase::checkObject(), clearToolCapabilities(), read_tool_capabilities(), and setToolCapabilities().

+ Here is the call graph for this function:

◆ l_set_wear_bar_params()

int ItemStackMetaRef::l_set_wear_bar_params ( lua_State * L)
staticprivate

References ModApiBase::checkObject(), clearWearBarParams(), read_wear_bar_params(), and setWearBarParams().

+ Here is the call graph for this function:

◆ Register()

void ItemStackMetaRef::Register ( lua_State * L)
static

References className, methods, and MetaDataRef::registerMetadataClass().

Referenced by ServerScripting::InitializeAsync(), ClientScripting::InitializeModApi(), EmergeScripting::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 LuaItemStack::getItem(), 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:

◆ setWearBarParams()

void ItemStackMetaRef::setWearBarParams ( const WearBarParams & params)
inlineprivate

References LuaItemStack::getItem(), istack, ItemStack::metadata, and ItemStackMetadata::setWearBarParams().

Referenced by l_set_wear_bar_params().

+ 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"
static

Referenced by create(), and Register().

◆ istack

◆ 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, get_keys),
luamethod(MetaDataRef, to_table),
luamethod(MetaDataRef, from_table),
luamethod(ItemStackMetaRef, set_tool_capabilities),
luamethod(ItemStackMetaRef, set_wear_bar_params),
{0,0}
}
Definition l_itemstackmeta.h:15
Definition l_metadata.h:18
#define luamethod(class, name)
Definition l_internal.h:16

Referenced by Register().


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