aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/script
diff options
context:
space:
mode:
authorFilippos Karapetis2011-01-23 14:49:50 +0000
committerFilippos Karapetis2011-01-23 14:49:50 +0000
commit00a0f8d15df8f241741e4a9a68a71641715ae062 (patch)
treed40be8437f7ca54dab9c77145bf72550bc5a3150 /engines/sword25/script
parent411d41d3d0a3e4d14187d4a980c25c0a2e41ad9c (diff)
downloadscummvm-rg350-00a0f8d15df8f241741e4a9a68a71641715ae062.tar.gz
scummvm-rg350-00a0f8d15df8f241741e4a9a68a71641715ae062.tar.bz2
scummvm-rg350-00a0f8d15df8f241741e4a9a68a71641715ae062.zip
SWORD25: Removed the custom log class and replaced it with warning/error/debugC calls
svn-id: r55462
Diffstat (limited to 'engines/sword25/script')
-rw-r--r--engines/sword25/script/lua_extensions.cpp1
-rw-r--r--engines/sword25/script/luabindhelper.cpp2
-rw-r--r--engines/sword25/script/luacallback.cpp4
-rw-r--r--engines/sword25/script/luascript.cpp18
4 files changed, 9 insertions, 16 deletions
diff --git a/engines/sword25/script/lua_extensions.cpp b/engines/sword25/script/lua_extensions.cpp
index 25a43e17d2..50d7acc52e 100644
--- a/engines/sword25/script/lua_extensions.cpp
+++ b/engines/sword25/script/lua_extensions.cpp
@@ -47,7 +47,6 @@ static int warning(lua_State *L) {
lua_pushstring(L, "WARNING - ");
lua_pushvalue(L, 1);
lua_concat(L, 3);
- BS_Log::log("%s\n", luaL_checkstring(L, -1));
lua_pop(L, 1);
#ifdef DEBUG
diff --git a/engines/sword25/script/luabindhelper.cpp b/engines/sword25/script/luabindhelper.cpp
index 5367854218..b227754489 100644
--- a/engines/sword25/script/luabindhelper.cpp
+++ b/engines/sword25/script/luabindhelper.cpp
@@ -36,8 +36,6 @@
#include "sword25/script/luabindhelper.h"
#include "sword25/script/luascript.h"
-#define BS_LOG_PREFIX "LUABINDHELPER"
-
namespace {
const char *METATABLES_TABLE_NAME = "__METATABLES";
const char *PERMANENTS_TABLE_NAME = "Permanents";
diff --git a/engines/sword25/script/luacallback.cpp b/engines/sword25/script/luacallback.cpp
index bb2c821aa8..39ce29ea77 100644
--- a/engines/sword25/script/luacallback.cpp
+++ b/engines/sword25/script/luacallback.cpp
@@ -42,8 +42,6 @@ const char *CALLBACKTABLE_NAME = "__CALLBACKS";
namespace Sword25 {
-#define BS_LOG_PREFIX "LUA"
-
LuaCallback::LuaCallback(lua_State *L) {
// Create callback table
lua_newtable(L);
@@ -122,7 +120,7 @@ void LuaCallback::invokeCallbackFunctions(lua_State *L, uint objectHandle) {
// Lua_pcall the function and the parameters pop themselves from the stack
if (lua_pcall(L, argumentCount, 0, 0) != 0) {
// An error has occurred
- BS_LOG_ERRORLN("An error occured executing a callback function: %s", lua_tostring(L, -1));
+ error("An error occured executing a callback function: %s", lua_tostring(L, -1));
// Pop error message from the stack
lua_pop(L, 1);
diff --git a/engines/sword25/script/luascript.cpp b/engines/sword25/script/luascript.cpp
index aa2bdb9e06..140c09041b 100644
--- a/engines/sword25/script/luascript.cpp
+++ b/engines/sword25/script/luascript.cpp
@@ -32,8 +32,6 @@
*
*/
-#define BS_LOG_PREFIX "LUA"
-
#include "common/array.h"
#include "common/debug-channels.h"
@@ -66,7 +64,7 @@ LuaScriptEngine::~LuaScriptEngine() {
namespace {
int panicCB(lua_State *L) {
- BS_LOG_ERRORLN("Lua panic. Error message: %s", lua_isnil(L, -1) ? "" : lua_tostring(L, -1));
+ error("Lua panic. Error message: %s", lua_isnil(L, -1) ? "" : lua_tostring(L, -1));
return 0;
}
@@ -82,7 +80,7 @@ bool LuaScriptEngine::init() {
// Lua-State initialisation, as well as standard libaries initialisation
_state = luaL_newstate();
if (!_state || ! registerStandardLibs() || !registerStandardLibExtensions()) {
- BS_LOG_ERRORLN("Lua could not be initialized.");
+ error("Lua could not be initialized.");
return false;
}
@@ -100,7 +98,7 @@ bool LuaScriptEngine::init() {
// Compile the code
if (luaL_loadbuffer(_state, errorHandlerCode, strlen(errorHandlerCode), "PCALL ERRORHANDLER") != 0) {
// An error occurred, so dislay the reason and exit
- BS_LOG_ERRORLN("Couldn't compile luaL_pcall errorhandler:\n%s", lua_tostring(_state, -1));
+ error("Couldn't compile luaL_pcall errorhandler:\n%s", lua_tostring(_state, -1));
lua_pop(_state, 1);
return false;
@@ -108,7 +106,7 @@ bool LuaScriptEngine::init() {
// Running the code, the error handler function sets the top of the stack
if (lua_pcall(_state, 0, 1, 0) != 0) {
// An error occurred, so dislay the reason and exit
- BS_LOG_ERRORLN("Couldn't prepare luaL_pcall errorhandler:\n%s", lua_tostring(_state, -1));
+ error("Couldn't prepare luaL_pcall errorhandler:\n%s", lua_tostring(_state, -1));
lua_pop(_state, 1);
return false;
@@ -135,7 +133,7 @@ bool LuaScriptEngine::init() {
lua_sethook(_state, debugHook, mask, 0);
}
- BS_LOGLN("Lua initialized.");
+ debugC(kDebugScript, "Lua initialized.");
return true;
}
@@ -154,7 +152,7 @@ bool LuaScriptEngine::executeFile(const Common::String &fileName) {
uint fileSize;
byte *fileData = pPackage->getFile(fileName, &fileSize);
if (!fileData) {
- BS_LOG_ERRORLN("Couldn't read \"%s\".", fileName.c_str());
+ error("Couldn't read \"%s\".", fileName.c_str());
#ifdef DEBUG
BS_ASSERT(__startStackDepth == lua_gettop(_state));
#endif
@@ -211,7 +209,7 @@ bool LuaScriptEngine::registerStandardLibs() {
bool LuaScriptEngine::executeBuffer(const byte *data, uint size, const Common::String &name) const {
// Compile buffer
if (luaL_loadbuffer(_state, (const char *)data, size, name.c_str()) != 0) {
- BS_LOG_ERRORLN("Couldn't compile \"%s\":\n%s", name.c_str(), lua_tostring(_state, -1));
+ error("Couldn't compile \"%s\":\n%s", name.c_str(), lua_tostring(_state, -1));
lua_pop(_state, 1);
return false;
@@ -223,7 +221,7 @@ bool LuaScriptEngine::executeBuffer(const byte *data, uint size, const Common::S
// Run buffer contents
if (lua_pcall(_state, 0, 0, -2) != 0) {
- BS_LOG_ERRORLN("An error occured while executing \"%s\":\n%s.",
+ error("An error occured while executing \"%s\":\n%s.",
name.c_str(),
lua_tostring(_state, -1));
lua_pop(_state, 2);