Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
l_modchannels.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation; either version 2.1 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public License along
16with this program; if not, write to the Free Software Foundation, Inc.,
1751 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*/
19
20#pragma once
21
22#include "lua_api/l_base.h"
23#include "config.h"
24
25class ModChannel;
26
28{
29private:
30 // mod_channel_join(name)
31 static int l_mod_channel_join(lua_State *L);
32
33public:
34 static void Initialize(lua_State *L, int top);
35};
36
38{
39public:
40 ModChannelRef(const std::string &modchannel);
41 ~ModChannelRef() = default;
42
43 static void Register(lua_State *L);
44 static void create(lua_State *L, const std::string &channel);
45
46 // leave()
47 static int l_leave(lua_State *L);
48
49 // send(message)
50 static int l_send_all(lua_State *L);
51
52 // is_writeable()
53 static int l_is_writeable(lua_State *L);
54
55 static const char className[];
56
57private:
58 // garbage collector
59 static int gc_object(lua_State *L);
60
61 static ModChannel *getobject(lua_State *L, ModChannelRef *ref);
62
63 std::string m_modchannel_name;
64
65 static const luaL_Reg methods[];
66};
Definition: l_base.h:43
Definition: l_modchannels.h:28
static void Initialize(lua_State *L, int top)
Definition: l_modchannels.cpp:44
static int l_mod_channel_join(lua_State *L)
Definition: l_modchannels.cpp:26
Definition: l_modchannels.h:38
static int l_send_all(lua_State *L)
Definition: l_modchannels.cpp:65
static void create(lua_State *L, const std::string &channel)
Definition: l_modchannels.cpp:98
static int gc_object(lua_State *L)
Definition: l_modchannels.cpp:106
~ModChannelRef()=default
std::string m_modchannel_name
Definition: l_modchannels.h:63
static ModChannel * getobject(lua_State *L, ModChannelRef *ref)
Definition: l_modchannels.cpp:113
static const luaL_Reg methods[]
Definition: l_modchannels.h:65
static int l_is_writeable(lua_State *L)
Definition: l_modchannels.cpp:79
static const char className[]
Definition: l_modchannels.h:55
static int l_leave(lua_State *L)
Definition: l_modchannels.cpp:58
Definition: modchannels.h:38