Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
l_modchannels.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
4
5#pragma once
6
7#include "lua_api/l_base.h"
8#include "config.h"
9
10class ModChannel;
11
13{
14private:
15 // mod_channel_join(name)
16 static int l_mod_channel_join(lua_State *L);
17
18public:
19 static void Initialize(lua_State *L, int top);
20};
21
23{
24public:
25 ModChannelRef(const std::string &modchannel);
26 ~ModChannelRef() = default;
27
28 static void Register(lua_State *L);
29 static void create(lua_State *L, const std::string &channel);
30
31 // leave()
32 static int l_leave(lua_State *L);
33
34 // send(message)
35 static int l_send_all(lua_State *L);
36
37 // is_writeable()
38 static int l_is_writeable(lua_State *L);
39
40 static const char className[];
41
42private:
43 // garbage collector
44 static int gc_object(lua_State *L);
45
46 static ModChannel *getobject(lua_State *L, ModChannelRef *ref);
47
48 std::string m_modchannel_name;
49
50 static const luaL_Reg methods[];
51};
Definition l_base.h:28
Definition l_modchannels.h:13
static void Initialize(lua_State *L, int top)
Definition l_modchannels.cpp:29
static int l_mod_channel_join(lua_State *L)
Definition l_modchannels.cpp:11
Definition l_modchannels.h:23
static int l_send_all(lua_State *L)
Definition l_modchannels.cpp:50
static void create(lua_State *L, const std::string &channel)
Definition l_modchannels.cpp:83
static int gc_object(lua_State *L)
Definition l_modchannels.cpp:91
~ModChannelRef()=default
std::string m_modchannel_name
Definition l_modchannels.h:48
static ModChannel * getobject(lua_State *L, ModChannelRef *ref)
Definition l_modchannels.cpp:98
static const luaL_Reg methods[]
Definition l_modchannels.h:104
static int l_is_writeable(lua_State *L)
Definition l_modchannels.cpp:64
ModChannelRef(const std::string &modchannel)
Definition l_modchannels.cpp:38
static const char className[]
Definition l_modchannels.h:40
static int l_leave(lua_State *L)
Definition l_modchannels.cpp:43
Definition modchannels.h:23