1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-14 09:05:19 +02:00

Modernize lua read (part 2 & 3): C++ templating assurance (#7410)

* Modernize lua read (part 2 & 3): C++ templating assurance

Implement the boolean reader
Implement the string reader
Also remove unused & unimplemented script_error_handler
Add a reader with default value
This commit is contained in:
Loïc Blot
2018-06-30 17:11:38 +02:00
committed by GitHub
parent 227c71eb76
commit eef62c82a2
35 changed files with 247 additions and 154 deletions

View File

@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common/c_types.h"
#include "common/c_internal.h"
#include "common/helper.h"
#include "gamedef.h"
extern "C" {
@@ -37,7 +38,7 @@ class Server;
class Environment;
class GUIEngine;
class ModApiBase {
class ModApiBase : protected LuaHelper {
public:
static ScriptApiBase* getScriptApiBase(lua_State *L);
@@ -69,17 +70,4 @@ public:
const char* name,
lua_CFunction func,
int top);
static bool isNaN(lua_State *L, int idx);
/**
* Read a value using a template type T from Lua State L and index
*
* @tparam T type to read from Lua
* @param L Lua state
* @param index Lua Index to read
* @return read value from Lua
*/
template<typename T>
static T readParam(lua_State *L, int index);
};