Minetest
5.9.0-dev
Loading...
Searching...
No Matches
l_playermeta.h
Go to the documentation of this file.
1
/*
2
Minetest
3
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
Copyright (C) 2017-8 rubenwardy <rw@rubenwardy.com>
5
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU Lesser General Public License as published by
8
the Free Software Foundation; either version 2.1 of the License, or
9
(at your option) any later version.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU Lesser General Public License for more details.
15
16
You should have received a copy of the GNU Lesser General Public License along
17
with this program; if not, write to the Free Software Foundation, Inc.,
18
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
*/
20
21
#pragma once
22
23
#include "
lua_api/l_base.h
"
24
#include "
lua_api/l_metadata.h
"
25
#include "
irrlichttypes_bloated.h
"
26
#include "
inventory.h
"
27
#include "
metadata.h
"
28
29
class
PlayerMetaRef
:
public
MetaDataRef
30
{
31
private
:
32
IMetadata
*
metadata
=
nullptr
;
33
34
static
const
luaL_Reg
methods
[];
35
36
virtual
IMetadata
*
getmeta
(
bool
auto_create);
37
38
virtual
void
clearMeta
();
39
40
virtual
void
reportMetadataChange
(
const
std::string *name =
nullptr
);
41
42
public
:
43
PlayerMetaRef
(
IMetadata
*
metadata
) :
metadata
(
metadata
) {}
44
~PlayerMetaRef
() =
default
;
45
46
// Creates an ItemStackMetaRef and leaves it on top of stack
47
// Not callable from Lua; all references are created on the C side.
48
static
void
create
(lua_State *L,
IMetadata
*
metadata
);
49
50
static
void
Register
(lua_State *L);
51
52
static
const
char
className
[];
53
};
IMetadata
Definition:
metadata.h:29
MetaDataRef
Definition:
l_metadata.h:33
PlayerMetaRef
Definition:
l_playermeta.h:30
PlayerMetaRef::create
static void create(lua_State *L, IMetadata *metadata)
Definition:
l_playermeta.cpp:46
PlayerMetaRef::clearMeta
virtual void clearMeta()
Definition:
l_playermeta.cpp:34
PlayerMetaRef::metadata
IMetadata * metadata
Definition:
l_playermeta.h:32
PlayerMetaRef::reportMetadataChange
virtual void reportMetadataChange(const std::string *name=nullptr)
Definition:
l_playermeta.cpp:39
PlayerMetaRef::className
static const char className[]
Definition:
l_playermeta.h:52
PlayerMetaRef::~PlayerMetaRef
~PlayerMetaRef()=default
PlayerMetaRef::getmeta
virtual IMetadata * getmeta(bool auto_create)
Definition:
l_playermeta.cpp:29
PlayerMetaRef::PlayerMetaRef
PlayerMetaRef(IMetadata *metadata)
Definition:
l_playermeta.h:43
PlayerMetaRef::methods
static const luaL_Reg methods[]
Definition:
l_playermeta.h:34
ELoginRegister::Register
@ Register
inventory.h
irrlichttypes_bloated.h
l_base.h
l_metadata.h
metadata.h
script
lua_api
l_playermeta.h
Generated on Sat May 4 2024 17:14:12 for Minetest by
1.9.6