aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/script/luascript.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2010-08-01 09:31:36 +0000
committerEugene Sandulenko2010-10-12 22:18:35 +0000
commit2006e564a1287ff31c2c6acedecf90034e784fd2 (patch)
tree4e1ebb10fedbd39f053691c3cd59b6157c545d37 /engines/sword25/script/luascript.cpp
parent53a9d2d0a1dab1119dc1cc12886321fa72743061 (diff)
downloadscummvm-rg350-2006e564a1287ff31c2c6acedecf90034e784fd2.tar.gz
scummvm-rg350-2006e564a1287ff31c2c6acedecf90034e784fd2.tar.bz2
scummvm-rg350-2006e564a1287ff31c2c6acedecf90034e784fd2.zip
SWORD25: Moved the Lua library into it's own namespace
Previously with some of the files I was leaving the #include references to the library inside the global namespace. However, since the engine itself is now inside a namespace, I had to do a lot of changes, such as lua_State to ::lua_State. This way is cleaner, and I just need to add a 'using namespace Lua' where needed. svn-id: r53198
Diffstat (limited to 'engines/sword25/script/luascript.cpp')
-rw-r--r--engines/sword25/script/luascript.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/engines/sword25/script/luascript.cpp b/engines/sword25/script/luascript.cpp
index 8af0128c72..129dd03c8a 100644
--- a/engines/sword25/script/luascript.cpp
+++ b/engines/sword25/script/luascript.cpp
@@ -38,28 +38,28 @@
// Includes
// -----------------------------------------------------------------------------
-//namespace {
+#include "sword25/package/packagemanager.h"
+#include "sword25/script/luascript.h"
+#include "sword25/script/luabindhelper.h"
+
+#include "sword25/kernel/outputpersistenceblock.h"
+#include "sword25/kernel/inputpersistenceblock.h"
-extern "C"
-{
+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"
}
-//}
-
-#include "sword25/package/packagemanager.h"
-#include "sword25/script/luascript.h"
-#include "sword25/script/luabindhelper.h"
-
-#include "sword25/kernel/outputpersistenceblock.h"
-#include "sword25/kernel/inputpersistenceblock.h"
+}
namespace Sword25 {
using namespace std;
+using namespace Lua;
// -----------------------------------------------------------------------------
// Constructor / Destructor
@@ -85,7 +85,7 @@ BS_Service *BS_LuaScriptEngine_CreateObject(BS_Kernel * KernelPtr) { return new
// -----------------------------------------------------------------------------
namespace {
- int PanicCB(::lua_State *L) {
+ int PanicCB(lua_State *L) {
BS_LOG_ERRORLN("Lua panic. Error message: %s", lua_isnil(L, -1) ? "" : lua_tostring(L, -1));
return 0;
}
@@ -193,7 +193,7 @@ bool BS_LuaScriptEngine::ExecuteString(const Common::String &Code) {
namespace {
- void RemoveForbiddenFunctions(::lua_State *L) {
+ void RemoveForbiddenFunctions(lua_State *L) {
static const char *FORBIDDEN_FUNCTIONS[] = {
"dofile",
0
@@ -326,7 +326,7 @@ namespace {
// -------------------------------------------------------------------------
- bool PushPermanentsTable(::lua_State *L, PERMANENT_TABLE_TYPE TableType) {
+ bool PushPermanentsTable(lua_State *L, PERMANENT_TABLE_TYPE TableType) {
// Permanents-Table
lua_newtable(L);
@@ -409,7 +409,7 @@ namespace {
// -----------------------------------------------------------------------------
namespace {
- int Chunkwriter(::lua_State *L, const void *p, size_t sz, void *ud) {
+ int Chunkwriter(lua_State *L, const void *p, size_t sz, void *ud) {
vector<unsigned char> & chunkData = *reinterpret_cast<vector<unsigned char> * >(ud);
const unsigned char *buffer = reinterpret_cast<const unsigned char *>(p);
@@ -457,7 +457,7 @@ namespace {
// ------------------------------------------------------------------------
- const char *Chunkreader(::lua_State *L, void *ud, size_t *sz) {
+ const char *Chunkreader(lua_State *L, void *ud, size_t *sz) {
ChunkreaderData & cd = *reinterpret_cast<ChunkreaderData *>(ud);
if (!cd.BufferReturned) {
@@ -471,7 +471,7 @@ namespace {
// -------------------------------------------------------------------------
- void ClearGlobalTable(::lua_State *L, const char **Exceptions) {
+ void ClearGlobalTable(lua_State *L, const char **Exceptions) {
// Iterate over all elements of the global table
lua_pushvalue(L, LUA_GLOBALSINDEX);
lua_pushnil(L);