aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/script/luascript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword25/script/luascript.cpp')
-rw-r--r--engines/sword25/script/luascript.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/engines/sword25/script/luascript.cpp b/engines/sword25/script/luascript.cpp
index 82166f7c25..aa2bdb9e06 100644
--- a/engines/sword25/script/luascript.cpp
+++ b/engines/sword25/script/luascript.cpp
@@ -45,21 +45,13 @@
#include "sword25/kernel/outputpersistenceblock.h"
#include "sword25/kernel/inputpersistenceblock.h"
-namespace Lua {
-
-extern "C" {
#include "sword25/util/lua/lua.h"
#include "sword25/util/lua/lualib.h"
#include "sword25/util/lua/lauxlib.h"
#include "sword25/util/pluto/pluto.h"
-}
-
-}
namespace Sword25 {
-using namespace Lua;
-
LuaScriptEngine::LuaScriptEngine(Kernel *KernelPtr) :
ScriptEngine(KernelPtr),
_state(0),
@@ -72,10 +64,6 @@ LuaScriptEngine::~LuaScriptEngine() {
lua_close(_state);
}
-Service *LuaScriptEngine_CreateObject(Kernel *KernelPtr) {
- return new LuaScriptEngine(KernelPtr);
-}
-
namespace {
int panicCB(lua_State *L) {
BS_LOG_ERRORLN("Lua panic. Error message: %s", lua_isnil(L, -1) ? "" : lua_tostring(L, -1));
@@ -159,7 +147,7 @@ bool LuaScriptEngine::executeFile(const Common::String &fileName) {
debug(2, "LuaScriptEngine::executeFile(%s)", fileName.c_str());
// Get a pointer to the package manager
- PackageManager *pPackage = static_cast<PackageManager *>(Kernel::GetInstance()->GetService("package"));
+ PackageManager *pPackage = Kernel::getInstance()->getPackage();
BS_ASSERT(pPackage);
// File read
@@ -431,7 +419,7 @@ bool LuaScriptEngine::persist(OutputPersistenceBlock &writer) {
pluto_persist(_state, chunkwriter, &chunkData);
// Persistenzdaten in den Writer schreiben.
- writer.write(&chunkData[0], chunkData.size());
+ writer.writeByteArray(chunkData);
// Die beiden Tabellen vom Stack nehmen.
lua_pop(_state, 2);
@@ -528,7 +516,7 @@ bool LuaScriptEngine::unpersist(InputPersistenceBlock &reader) {
// Persisted Lua data
Common::Array<byte> chunkData;
- reader.read(chunkData);
+ reader.readByteArray(chunkData);
// Chunk-Reader initialisation. It is used with pluto_unpersist to restore read data
ChunkreaderData cd;