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:
@@ -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);
|
||||
};
|
||||
|
Reference in New Issue
Block a user