Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
l_storage.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4// Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
5
6#pragma once
7
8#include "l_metadata.h"
9#include "lua_api/l_base.h"
10#include "content/mods.h"
11
13{
14protected:
15 static int l_get_mod_storage(lua_State *L);
16
17public:
18 static void Initialize(lua_State *L, int top);
19};
20
21class StorageRef : public MetaDataRef
22{
23private:
25
26 static const luaL_Reg methods[];
27
28 virtual IMetadata *getmeta(bool auto_create);
29 virtual void clearMeta();
30
31public:
32 StorageRef(const std::string &mod_name, ModStorageDatabase *db): m_object(mod_name, db) {}
33 ~StorageRef() = default;
34
35 static void Register(lua_State *L);
36 static void create(lua_State *L, const std::string &mod_name, ModStorageDatabase *db);
37
38 static const char className[];
39};
Definition metadata.h:14
Definition l_metadata.h:18
Definition l_base.h:28
Definition l_storage.h:13
static void Initialize(lua_State *L, int top)
Definition l_storage.cpp:24
static int l_get_mod_storage(lua_State *L)
Definition l_storage.cpp:10
Definition database.h:74
Definition mods.h:99
Definition l_storage.h:22
static void create(lua_State *L, const std::string &mod_name, ModStorageDatabase *db)
Definition l_storage.cpp:29
ModStorage m_object
Definition l_storage.h:24
StorageRef(const std::string &mod_name, ModStorageDatabase *db)
Definition l_storage.h:32
~StorageRef()=default
virtual void clearMeta()
Definition l_storage.cpp:47
static const char className[]
Definition l_storage.h:38
static const luaL_Reg methods[]
Definition l_storage.h:53
virtual IMetadata * getmeta(bool auto_create)
Definition l_storage.cpp:42