Minetest  5.4.0
LuaItemStack Class Reference

#include <l_item.h>

+ Inheritance diagram for LuaItemStack:
+ Collaboration diagram for LuaItemStack:

Public Member Functions

 LuaItemStack (const ItemStack &item)
 
 ~LuaItemStack ()=default
 
const ItemStackgetItem () const
 
ItemStackgetItem ()
 

Static Public Member Functions

static int create_object (lua_State *L)
 
static int create (lua_State *L, const ItemStack &item)
 
static LuaItemStackcheckobject (lua_State *L, int narg)
 
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...
 

Static Private Member Functions

static int gc_object (lua_State *L)
 
static int mt_tostring (lua_State *L)
 
static int l_is_empty (lua_State *L)
 
static int l_get_name (lua_State *L)
 
static int l_set_name (lua_State *L)
 
static int l_get_count (lua_State *L)
 
static int l_set_count (lua_State *L)
 
static int l_get_wear (lua_State *L)
 
static int l_set_wear (lua_State *L)
 
static int l_get_meta (lua_State *L)
 
static int l_get_metadata (lua_State *L)
 
static int l_set_metadata (lua_State *L)
 
static int l_get_description (lua_State *L)
 
static int l_get_short_description (lua_State *L)
 
static int l_clear (lua_State *L)
 
static int l_replace (lua_State *L)
 
static int l_to_string (lua_State *L)
 
static int l_to_table (lua_State *L)
 
static int l_get_stack_max (lua_State *L)
 
static int l_get_free_space (lua_State *L)
 
static int l_is_known (lua_State *L)
 
static int l_get_definition (lua_State *L)
 
static int l_get_tool_capabilities (lua_State *L)
 
static int l_add_wear (lua_State *L)
 
static int l_add_item (lua_State *L)
 
static int l_item_fits (lua_State *L)
 
static int l_take_item (lua_State *L)
 
static int l_peek_item (lua_State *L)
 

Private Attributes

ItemStack m_stack
 

Static Private Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from LuaHelper
template<>
bool readParam (lua_State *L, int index)
 
- 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

◆ LuaItemStack()

LuaItemStack::LuaItemStack ( const ItemStack item)

Referenced by create(), and create_object().

+ Here is the caller graph for this function:

◆ ~LuaItemStack()

LuaItemStack::~LuaItemStack ( )
default

Member Function Documentation

◆ checkobject()

LuaItemStack * LuaItemStack::checkobject ( lua_State *  L,
int  narg 
)
static

◆ create()

◆ create_object()

int LuaItemStack::create_object ( lua_State *  L)
static

References LuaItemStack(), className, ModApiBase::getGameDef(), NO_MAP_LOCK_REQUIRED, and read_item().

Referenced by Register().

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

◆ gc_object()

int LuaItemStack::gc_object ( lua_State *  L)
staticprivate

Referenced by Register().

+ Here is the caller graph for this function:

◆ getItem() [1/2]

ItemStack & LuaItemStack::getItem ( )

References m_stack.

◆ getItem() [2/2]

const ItemStack & LuaItemStack::getItem ( ) const

References m_stack.

Referenced by read_item().

+ Here is the caller graph for this function:

◆ l_add_item()

int LuaItemStack::l_add_item ( lua_State *  L)
staticprivate

References ItemStack::addItem(), checkobject(), create(), ModApiBase::getGameDef(), m_stack, NO_MAP_LOCK_REQUIRED, and read_item().

+ Here is the call graph for this function:

◆ l_add_wear()

int LuaItemStack::l_add_wear ( lua_State *  L)
staticprivate

References ItemStack::addWear(), checkobject(), ModApiBase::getGameDef(), m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_clear()

int LuaItemStack::l_clear ( lua_State *  L)
staticprivate

References checkobject(), ItemStack::clear(), m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_count()

int LuaItemStack::l_get_count ( lua_State *  L)
staticprivate

References checkobject(), ItemStack::count, m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_definition()

int LuaItemStack::l_get_definition ( lua_State *  L)
staticprivate

References checkobject(), m_stack, ItemStack::name, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_description()

int LuaItemStack::l_get_description ( lua_State *  L)
staticprivate

References checkobject(), ItemStack::getDescription(), ModApiBase::getGameDef(), m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_free_space()

int LuaItemStack::l_get_free_space ( lua_State *  L)
staticprivate

References checkobject(), ItemStack::freeSpace(), ModApiBase::getGameDef(), m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_meta()

int LuaItemStack::l_get_meta ( lua_State *  L)
staticprivate

References checkobject(), ItemStackMetaRef::create(), m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_metadata()

int LuaItemStack::l_get_metadata ( lua_State *  L)
staticprivate

References checkobject(), Metadata::getString(), m_stack, ItemStack::metadata, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_name()

int LuaItemStack::l_get_name ( lua_State *  L)
staticprivate

References checkobject(), m_stack, ItemStack::name, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_short_description()

int LuaItemStack::l_get_short_description ( lua_State *  L)
staticprivate

References checkobject(), ModApiBase::getGameDef(), ItemStack::getShortDescription(), m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_stack_max()

int LuaItemStack::l_get_stack_max ( lua_State *  L)
staticprivate

References checkobject(), ModApiBase::getGameDef(), ItemStack::getStackMax(), m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_get_tool_capabilities()

int LuaItemStack::l_get_tool_capabilities ( lua_State *  L)
staticprivate

References checkobject(), ModApiBase::getGameDef(), ItemStack::getToolCapabilities(), m_stack, NO_MAP_LOCK_REQUIRED, and push_tool_capabilities().

+ Here is the call graph for this function:

◆ l_get_wear()

int LuaItemStack::l_get_wear ( lua_State *  L)
staticprivate

References checkobject(), m_stack, NO_MAP_LOCK_REQUIRED, and ItemStack::wear.

+ Here is the call graph for this function:

◆ l_is_empty()

int LuaItemStack::l_is_empty ( lua_State *  L)
staticprivate

References checkobject(), ItemStack::empty(), m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_is_known()

int LuaItemStack::l_is_known ( lua_State *  L)
staticprivate

References checkobject(), ModApiBase::getGameDef(), ItemStack::isKnown(), m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_item_fits()

int LuaItemStack::l_item_fits ( lua_State *  L)
staticprivate

References checkobject(), create(), ModApiBase::getGameDef(), ItemStack::itemFits(), m_stack, NO_MAP_LOCK_REQUIRED, and read_item().

+ Here is the call graph for this function:

◆ l_peek_item()

int LuaItemStack::l_peek_item ( lua_State *  L)
staticprivate

References checkobject(), create(), m_stack, NO_MAP_LOCK_REQUIRED, and ItemStack::peekItem().

+ Here is the call graph for this function:

◆ l_replace()

int LuaItemStack::l_replace ( lua_State *  L)
staticprivate

References checkobject(), ModApiBase::getGameDef(), m_stack, NO_MAP_LOCK_REQUIRED, and read_item().

+ Here is the call graph for this function:

◆ l_set_count()

int LuaItemStack::l_set_count ( lua_State *  L)
staticprivate

References checkobject(), ItemStack::clear(), ItemStack::count, m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_set_metadata()

int LuaItemStack::l_set_metadata ( lua_State *  L)
staticprivate

References checkobject(), m_stack, ItemStack::metadata, NO_MAP_LOCK_REQUIRED, and ItemStackMetadata::setString().

+ Here is the call graph for this function:

◆ l_set_name()

int LuaItemStack::l_set_name ( lua_State *  L)
staticprivate

References checkobject(), ItemStack::clear(), ItemStack::empty(), m_stack, ItemStack::name, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_set_wear()

int LuaItemStack::l_set_wear ( lua_State *  L)
staticprivate

References checkobject(), ItemStack::clear(), m_stack, NO_MAP_LOCK_REQUIRED, and ItemStack::wear.

+ Here is the call graph for this function:

◆ l_take_item()

int LuaItemStack::l_take_item ( lua_State *  L)
staticprivate

References checkobject(), create(), m_stack, NO_MAP_LOCK_REQUIRED, and ItemStack::takeItem().

+ Here is the call graph for this function:

◆ l_to_string()

int LuaItemStack::l_to_string ( lua_State *  L)
staticprivate

References checkobject(), ItemStack::getItemString(), m_stack, and NO_MAP_LOCK_REQUIRED.

+ Here is the call graph for this function:

◆ l_to_table()

int LuaItemStack::l_to_table ( lua_State *  L)
staticprivate

References checkobject(), ItemStack::count, ItemStack::empty(), Metadata::getString(), Metadata::getStrings(), m_stack, ItemStack::metadata, ItemStack::name, NO_MAP_LOCK_REQUIRED, and ItemStack::wear.

+ Here is the call graph for this function:

◆ mt_tostring()

int LuaItemStack::mt_tostring ( lua_State *  L)
staticprivate

References checkobject(), ItemStack::getItemString(), and m_stack.

Referenced by Register().

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

◆ Register()

void LuaItemStack::Register ( lua_State *  L)
static

References className, create_object(), gc_object(), methods, and mt_tostring().

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

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

Member Data Documentation

◆ className

const char LuaItemStack::className = "ItemStack"
staticprivate

◆ m_stack

◆ methods

const luaL_Reg LuaItemStack::methods
staticprivate
Initial value:
= {
luamethod(LuaItemStack, is_empty),
luamethod(LuaItemStack, get_name),
luamethod(LuaItemStack, set_name),
luamethod(LuaItemStack, get_count),
luamethod(LuaItemStack, set_count),
luamethod(LuaItemStack, get_wear),
luamethod(LuaItemStack, set_wear),
luamethod(LuaItemStack, get_meta),
luamethod(LuaItemStack, get_metadata),
luamethod(LuaItemStack, set_metadata),
luamethod(LuaItemStack, get_description),
luamethod(LuaItemStack, get_short_description),
luamethod(LuaItemStack, to_string),
luamethod(LuaItemStack, to_table),
luamethod(LuaItemStack, get_stack_max),
luamethod(LuaItemStack, get_free_space),
luamethod(LuaItemStack, is_known),
luamethod(LuaItemStack, get_definition),
luamethod(LuaItemStack, get_tool_capabilities),
luamethod(LuaItemStack, add_wear),
luamethod(LuaItemStack, add_item),
luamethod(LuaItemStack, item_fits),
luamethod(LuaItemStack, take_item),
luamethod(LuaItemStack, peek_item),
{0,0}
}
Definition: l_item.h:25
#define luamethod(class, name)
Definition: l_internal.h:31

Referenced by Register().


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