Luanti
5.11.0-dev
Loading...
Searching...
No Matches
helper.h
Go to the documentation of this file.
1
// Luanti
2
// SPDX-License-Identifier: LGPL-2.1-or-later
3
// Copyright (C) 2018 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
4
5
#pragma once
6
7
#include <string_view>
8
9
extern
"C"
{
10
#include <lua.h>
11
}
12
13
class
LuaHelper
14
{
15
protected
:
24
template
<
typename
T>
25
static
T
readParam
(lua_State *L,
int
index);
26
36
template
<
typename
T>
37
static
inline
T
readParam
(lua_State *L,
int
index,
const
T &default_value)
38
{
39
return
lua_isnoneornil(L, index) ? default_value :
readParam<T>
(L, index);
40
}
41
};
42
43
// (only declared for documentation purposes:)
44
55
template
<>
56
std::string_view
LuaHelper::readParam
(lua_State *L,
int
index);
LuaHelper
Definition
helper.h:14
LuaHelper::readParam
static T readParam(lua_State *L, int index)
Read a value using a template type T from Lua state L at index.
LuaHelper::readParam
static T readParam(lua_State *L, int index, const T &default_value)
Read a value using a template type T from Lua state L at index.
Definition
helper.h:37
script
common
helper.h
Generated on Sun Dec 1 2024 10:42:56 for Luanti by
1.11.0