Luanti 5.16.0-dev
Loading...
Searching...
No Matches
StorageRef Class Reference

#include <l_storage.h>

Inheritance diagram for StorageRef:
Collaboration diagram for StorageRef:

Public Member Functions

 StorageRef (const std::string &mod_name, ModStorageDatabase *db)
 ~StorageRef ()=default
Public Member Functions inherited from MetaDataRef
virtual ~MetaDataRef ()=default

Static Public Member Functions

static void Register (lua_State *L)
static void create (lua_State *L, const std::string &mod_name, ModStorageDatabase *db)
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)
template<typename T>
static void registerClass (lua_State *L, 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 [] = "StorageRef"

Private Member Functions

virtual IMetadatagetmeta (bool auto_create)
virtual void clearMeta ()

Private Attributes

ModStorage m_object

Static Private Attributes

static const luaL_Reg methods []

Additional Inherited Members

Protected Member Functions inherited from MetaDataRef
virtual void reportMetadataChange (const std::string *name=nullptr)
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
template<class T>
static void registerMetadataClass (lua_State *L, 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

◆ StorageRef()

StorageRef::StorageRef ( const std::string & mod_name,
ModStorageDatabase * db )
inline

References m_object.

Referenced by create().

Here is the caller graph for this function:

◆ ~StorageRef()

StorageRef::~StorageRef ( )
default

Member Function Documentation

◆ clearMeta()

void StorageRef::clearMeta ( )
privatevirtual

Implements MetaDataRef.

References m_object.

◆ create()

void StorageRef::create ( lua_State * L,
const std::string & mod_name,
ModStorageDatabase * db )
static

References StorageRef(), and className.

Referenced by ModApiStorage::l_get_mod_storage().

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

◆ getmeta()

IMetadata * StorageRef::getmeta ( bool auto_create)
privatevirtual

Implements MetaDataRef.

References m_object.

◆ Register()

void StorageRef::Register ( lua_State * L)
static

References methods, and MetaDataRef::registerMetadataClass().

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 StorageRef::className = "StorageRef"
static

Referenced by create().

◆ m_object

ModStorage StorageRef::m_object
private

Referenced by StorageRef(), clearMeta(), and getmeta().

◆ methods

const luaL_Reg StorageRef::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),
{0,0}
}
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: