Luanti 5.15.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
9class ModChannel;
10
12{
13private:
14 // mod_channel_join(name)
15 static int l_mod_channel_join(lua_State *L);
16
17public:
18 static void Initialize(lua_State *L, int top);
19};
20
22{
23public:
24 ModChannelRef(const std::string &modchannel);
25 ~ModChannelRef() = default;
26
27 static void Register(lua_State *L);
28 static void create(lua_State *L, const std::string &channel);
29
30 // leave()
31 static int l_leave(lua_State *L);
32
33 // send(message)
34 static int l_send_all(lua_State *L);
35
36 // is_writeable()
37 static int l_is_writeable(lua_State *L);
38
39 static const char className[];
40
41private:
42 // garbage collector
43 static int gc_object(lua_State *L);
44
45 static ModChannel *getobject(lua_State *L, ModChannelRef *ref);
46
47 std::string m_modchannel_name;
48
49 static const luaL_Reg methods[];
50};
Definition l_base.h:27
Definition l_modchannels.h:12
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:22
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:47
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:39
static int l_leave(lua_State *L)
Definition l_modchannels.cpp:43
Definition modchannels.h:23