diff options
author | madmaxoft <github@xoft.cz> | 2013-08-08 16:30:02 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-08-08 16:30:02 +0200 |
commit | eb323166d9ae600fe422725ea29575ba4613b6d2 (patch) | |
tree | bad726267d13fec9994a2c20e8d88885fca29bd0 /source/LuaScript.cpp | |
parent | cPlugin_NewLua is now completely rewritten to use templated LuaState calls. (diff) | |
download | cuberite-eb323166d9ae600fe422725ea29575ba4613b6d2.tar cuberite-eb323166d9ae600fe422725ea29575ba4613b6d2.tar.gz cuberite-eb323166d9ae600fe422725ea29575ba4613b6d2.tar.bz2 cuberite-eb323166d9ae600fe422725ea29575ba4613b6d2.tar.lz cuberite-eb323166d9ae600fe422725ea29575ba4613b6d2.tar.xz cuberite-eb323166d9ae600fe422725ea29575ba4613b6d2.tar.zst cuberite-eb323166d9ae600fe422725ea29575ba4613b6d2.zip |
Diffstat (limited to '')
-rw-r--r-- | source/LuaScript.cpp | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/source/LuaScript.cpp b/source/LuaScript.cpp deleted file mode 100644 index d406c2c02..000000000 --- a/source/LuaScript.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// LuaScript.cpp - -// Implements the cLuaScript class that loads a Lua script file to produce a web template out of it - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "LuaScript.h" -#include "tolua++.h" - - - - - -cLuaScript::cLuaScript() - : m_LuaState("cLuaScript") -{ - -} - - - - - -void cLuaScript::Initialize() -{ - // Check to see if this script has not been initialized before - ASSERT(!m_LuaState.IsValid()); - - // Create a Lua state and bind all libraries to it - m_LuaState.Create(); -} - - - - - -bool cLuaScript::LoadFile(const char * a_FilePath) -{ - // Make sure the plugin is initialized - ASSERT(m_LuaState.IsValid()); - - return m_LuaState.LoadFile(a_FilePath); -} - - - - - -bool cLuaScript::CallShowPage(cWebAdmin & a_WebAdmin, HTTPTemplateRequest & a_Request, AString & a_ReturnedString) -{ - ASSERT(m_LuaState.IsValid()); - - m_LuaState.PushFunction("ShowPage"); - m_LuaState.PushUserType(&a_WebAdmin, "cWebAdmin"); - m_LuaState.PushUserType(&a_Request, "HTTPTemplateRequest"); - if (!m_LuaState.CallFunction(1)) - { - return false; - } - if (lua_isstring(m_LuaState, -1)) - { - a_ReturnedString.assign(tolua_tostring(m_LuaState, -1, "")); - } - lua_pop(m_LuaState, 1); - return true; -} - - - - |