summaryrefslogtreecommitdiffstats
path: root/source/LuaScript.h
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-06 19:28:09 +0200
committermadmaxoft <github@xoft.cz>2013-08-06 19:28:09 +0200
commitc55fabb5ad34ec57760b90ea11960f7f426990db (patch)
treeeaa53bca6eff7fca7d4547b46860222d9580af9c /source/LuaScript.h
parentFixed compilation in ManualBindings (diff)
downloadcuberite-c55fabb5ad34ec57760b90ea11960f7f426990db.tar
cuberite-c55fabb5ad34ec57760b90ea11960f7f426990db.tar.gz
cuberite-c55fabb5ad34ec57760b90ea11960f7f426990db.tar.bz2
cuberite-c55fabb5ad34ec57760b90ea11960f7f426990db.tar.lz
cuberite-c55fabb5ad34ec57760b90ea11960f7f426990db.tar.xz
cuberite-c55fabb5ad34ec57760b90ea11960f7f426990db.tar.zst
cuberite-c55fabb5ad34ec57760b90ea11960f7f426990db.zip
Diffstat (limited to '')
-rw-r--r--source/LuaScript.h36
1 files changed, 16 insertions, 20 deletions
diff --git a/source/LuaScript.h b/source/LuaScript.h
index f98b2e65b..6c224e115 100644
--- a/source/LuaScript.h
+++ b/source/LuaScript.h
@@ -9,12 +9,13 @@
#pragma once
-struct lua_State;
+#include "LuaState.h"
+/*
struct sLuaUsertype
{
sLuaUsertype(void* a_pObject, const char* a_pClassName) : Object(a_pObject), ClassName(a_pClassName) {}
@@ -22,6 +23,15 @@ struct sLuaUsertype
void* Object;
const char* ClassName;
} ;
+*/
+
+
+
+
+
+// fwd:
+class cWebAdmin;
+struct HTTPTemplateRequest;
@@ -30,32 +40,18 @@ struct sLuaUsertype
class cLuaScript
{
public:
- cLuaScript();
- ~cLuaScript();
+ cLuaScript(void);
/// Prepares a Lua state
- void Initialize();
+ void Initialize();
/// Load a Lua script on the given path
- bool LoadFile(const char* a_FilePath);
-
- /// Execute the loaded Lua script
- bool Execute();
+ bool LoadFile(const char * a_FilePath);
- /// Call a function on the Lua script. Put all overloads here
- bool CallFunction(const char* a_Function, AString& ReturnedString);
- bool CallFunction(const char* a_Function, const sLuaUsertype& a_UserType, AString& ReturnedString);
- bool CallFunction(const char* a_Function, const sLuaUsertype& a_UserType1, const sLuaUsertype& a_UserType2, AString& ReturnedString);
+ bool CallShowPage(cWebAdmin & a_WebAdmin, HTTPTemplateRequest & a_Request, AString & a_ReturnedString);
protected:
- /// Reports an error in the log if a_Status is flagged as an error. Returns true when a_Status is flagged as error, returns false when no error occured.
- bool ReportErrors(int a_Status);
-
- /// Helper functions for calling functions in Lua
- bool LuaPushFunction(const char * a_FunctionName, bool a_bLogError = true);
- bool LuaCallFunction(int a_NumArgs, int a_NumResults, const char * a_FunctionName ); // a_FunctionName is only used for error messages, nothing else
-private:
- lua_State* m_LuaState;
+ cLuaState m_LuaState;
} ;