diff options
author | Alexander Harkness <bearbin@gmail.com> | 2013-08-07 19:37:03 +0200 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2013-08-07 19:37:03 +0200 |
commit | be7a6d7a6679fd17e88e9f5131036d69978e4151 (patch) | |
tree | 8e1b46a9b8ac8d3d47a65f903a63e063e5550e94 /source/LuaScript.h | |
parent | Drag in the latest core changes. (diff) | |
parent | Merge pull request #48 from mc-server/BlockTracing (diff) | |
download | cuberite-be7a6d7a6679fd17e88e9f5131036d69978e4151.tar cuberite-be7a6d7a6679fd17e88e9f5131036d69978e4151.tar.gz cuberite-be7a6d7a6679fd17e88e9f5131036d69978e4151.tar.bz2 cuberite-be7a6d7a6679fd17e88e9f5131036d69978e4151.tar.lz cuberite-be7a6d7a6679fd17e88e9f5131036d69978e4151.tar.xz cuberite-be7a6d7a6679fd17e88e9f5131036d69978e4151.tar.zst cuberite-be7a6d7a6679fd17e88e9f5131036d69978e4151.zip |
Diffstat (limited to 'source/LuaScript.h')
-rw-r--r-- | source/LuaScript.h | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/source/LuaScript.h b/source/LuaScript.h index f98b2e65b..99ccb3d49 100644 --- a/source/LuaScript.h +++ b/source/LuaScript.h @@ -9,19 +9,15 @@ #pragma once -struct lua_State; +#include "LuaState.h" -struct sLuaUsertype -{ - sLuaUsertype(void* a_pObject, const char* a_pClassName) : Object(a_pObject), ClassName(a_pClassName) {} - // - void* Object; - const char* ClassName; -} ; +// fwd: +class cWebAdmin; +struct HTTPTemplateRequest; @@ -30,32 +26,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; } ; |