Luanti
5.11.0-dev
Loading...
Searching...
No Matches
l_playermeta.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-8 rubenwardy <rw@rubenwardy.com>
5
6
#pragma once
7
8
#include "
lua_api/l_base.h
"
9
#include "
lua_api/l_metadata.h
"
10
#include "
irrlichttypes_bloated.h
"
11
#include "
inventory.h
"
12
13
class
ServerEnvironment
;
14
15
class
PlayerMetaRef
:
public
MetaDataRef
16
{
17
private
:
18
ServerEnvironment
*
m_env
;
19
std::string
m_name
;
20
21
static
const
luaL_Reg
methods
[];
22
23
virtual
IMetadata
*
getmeta
(
bool
auto_create);
24
25
virtual
void
clearMeta
();
26
27
virtual
void
reportMetadataChange
(
const
std::string *name =
nullptr
);
28
29
public
:
30
PlayerMetaRef
(
ServerEnvironment
*env, std::string_view name) :
31
m_env
(env),
m_name
(name)
32
{
33
assert(
m_env
);
34
assert(!
m_name
.empty());
35
}
36
~PlayerMetaRef
() =
default
;
37
38
// Creates an PlayerMetaRef and leaves it on top of stack
39
// Not callable from Lua; all references are created on the C side.
40
static
void
create
(lua_State *L,
ServerEnvironment
*env, std::string_view name);
41
42
static
void
Register
(lua_State *L);
43
44
static
const
char
className
[];
45
};
IMetadata
Definition
metadata.h:14
MetaDataRef
Definition
l_metadata.h:18
PlayerMetaRef
Definition
l_playermeta.h:16
PlayerMetaRef::PlayerMetaRef
PlayerMetaRef(ServerEnvironment *env, std::string_view name)
Definition
l_playermeta.h:30
PlayerMetaRef::create
static void create(lua_State *L, ServerEnvironment *env, std::string_view name)
Definition
l_playermeta.cpp:37
PlayerMetaRef::clearMeta
virtual void clearMeta()
Definition
l_playermeta.cpp:24
PlayerMetaRef::reportMetadataChange
virtual void reportMetadataChange(const std::string *name=nullptr)
Definition
l_playermeta.cpp:30
PlayerMetaRef::m_name
std::string m_name
Definition
l_playermeta.h:19
PlayerMetaRef::m_env
ServerEnvironment * m_env
Definition
l_playermeta.h:18
PlayerMetaRef::className
static const char className[]
Definition
l_playermeta.h:44
PlayerMetaRef::~PlayerMetaRef
~PlayerMetaRef()=default
PlayerMetaRef::getmeta
virtual IMetadata * getmeta(bool auto_create)
Definition
l_playermeta.cpp:17
PlayerMetaRef::methods
static const luaL_Reg methods[]
Definition
l_playermeta.h:51
ServerEnvironment
Definition
serverenvironment.h:219
ELoginRegister::Register
@ Register
inventory.h
irrlichttypes_bloated.h
l_base.h
l_metadata.h
script
lua_api
l_playermeta.h
Generated on Sun Dec 1 2024 10:42:56 for Luanti by
1.11.0