Index: code/branches/ceguilua/src/CMakeLists.txt
===================================================================
--- code/branches/ceguilua/src/CMakeLists.txt	(revision 1803)
+++ code/branches/ceguilua/src/CMakeLists.txt	(revision 1804)
@@ -2,9 +2,15 @@
 INCLUDE_DIRECTORIES(..)
 INCLUDE_DIRECTORIES(orxonox)
-INCLUDE_DIRECTORIES(tolua)
+#INCLUDE_DIRECTORIES(tolua)
 
 ADD_SUBDIRECTORY(cpptcl)
 ADD_SUBDIRECTORY(ois)
 ADD_SUBDIRECTORY(tinyxml)
+
+# This section deals with Lua version problems because CEGUILua scripting
+# module for CEGUI also uses Lua, but maybe with a different version.
+# So first, find out what CEGUI version we have.
+
+
 ADD_SUBDIRECTORY(tolua)
 
@@ -14,6 +20,2 @@
 ADD_SUBDIRECTORY(network)
 ADD_SUBDIRECTORY(orxonox)
-
-# This section deals with Lua version problems because CEGUILua scripting
-# module for CEGUI also uses Lua, but maybe with a different version.
-# So first, find out what CEGUI version we have.
Index: code/branches/ceguilua/src/ceguilua-0.5.0b/ceguilua/CMakeLists.txt
===================================================================
--- code/branches/ceguilua/src/ceguilua-0.5.0b/ceguilua/CMakeLists.txt	(revision 1803)
+++ code/branches/ceguilua/src/ceguilua-0.5.0b/ceguilua/CMakeLists.txt	(revision 1804)
@@ -9,2 +9,4 @@
 
 ADD_LIBRARY( ceguilua_orxonox SHARED ${LUA_SRC_FILES} )
+
+TARGET_LINK_LIBRARIES( ceguilua_orxonox lua_orxonox )
Index: code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/CEGUILua.cpp
===================================================================
--- code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/CEGUILua.cpp	(revision 1803)
+++ code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/CEGUILua.cpp	(revision 1804)
@@ -28,7 +28,4 @@
  *   OTHER DEALINGS IN THE SOFTWARE.
  ***************************************************************************/
-#ifdef HAVE_CONFIG_H
-#   include "config.h"
-#endif
 
 #include "CEGUI.h"
@@ -40,11 +37,6 @@
 
 // include Lua libs and tolua++
-extern "C" {
-#include "lua.h"
-#include "lualib.h"
-#include "lauxlib.h"
-}
-
-#include "tolua++.h"
+#include "lua/lua.hpp"
+#include "tolua/tolua++.h"
 
 // prototype for bindings initialisation function
@@ -61,19 +53,17 @@
 LuaScriptModule::LuaScriptModule()
 {
-    #if CEGUI_LUA_VER >= 51
-        static const luaL_Reg lualibs[] = {
-            {"", luaopen_base},
-            {LUA_LOADLIBNAME, luaopen_package},
-            {LUA_TABLIBNAME, luaopen_table},
-            {LUA_IOLIBNAME, luaopen_io},
-            {LUA_OSLIBNAME, luaopen_os},
-            {LUA_STRLIBNAME, luaopen_string},
-            {LUA_MATHLIBNAME, luaopen_math},
-        #if defined(DEBUG) || defined (_DEBUG)
-                {LUA_DBLIBNAME, luaopen_debug},
-        #endif
-            {0, 0}
-        };
-    #endif /* CEGUI_LUA_VER >= 51 */
+    static const luaL_Reg lualibs[] = {
+        {"", luaopen_base},
+        {LUA_LOADLIBNAME, luaopen_package},
+        {LUA_TABLIBNAME, luaopen_table},
+        {LUA_IOLIBNAME, luaopen_io},
+        {LUA_OSLIBNAME, luaopen_os},
+        {LUA_STRLIBNAME, luaopen_string},
+        {LUA_MATHLIBNAME, luaopen_math},
+    #if defined(DEBUG) || defined (_DEBUG)
+        {LUA_DBLIBNAME, luaopen_debug},
+    #endif
+        {0, 0}
+    };
 
     // create a lua state
@@ -82,22 +72,11 @@
 
     // init all standard libraries
-    #if CEGUI_LUA_VER >= 51
-            const luaL_Reg *lib = lualibs;
-            for (; lib->func; lib++)
-            {
-                lua_pushcfunction(d_state, lib->func);
-                lua_pushstring(d_state, lib->name);
-                lua_call(d_state, 1, 0);
-            }
-    #else /* CEGUI_LUA_VER >= 51 */
-        luaopen_base(d_state);
-        luaopen_io(d_state);
-        luaopen_string(d_state);
-        luaopen_table(d_state);
-        luaopen_math(d_state);
-        #if defined(DEBUG) || defined (_DEBUG)
-            luaopen_debug(d_state);
-        #endif
-    #endif /* CEGUI_LUA_VER >= 51 */
+    const luaL_Reg *lib = lualibs;
+    for (; lib->func; lib++)
+    {
+        lua_pushcfunction(d_state, lib->func);
+        lua_pushstring(d_state, lib->name);
+        lua_call(d_state, 1, 0);
+    }
 
     setModuleIdentifierString();
Index: code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp
===================================================================
--- code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp	(revision 1803)
+++ code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp	(revision 1804)
@@ -34,11 +34,6 @@
 
 // include Lua libs and tolua++
-extern "C" {
-#include "lua.h"
-#include "lualib.h"
-#include "lauxlib.h"
-}
-
-#include "tolua++.h"
+#include "lua/lua.hpp"
+#include "tolua/tolua++.h"
 
 // Start of CEGUI namespace section
Index: code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/CMakeLists.txt
===================================================================
--- code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/CMakeLists.txt	(revision 1803)
+++ code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/CMakeLists.txt	(revision 1804)
@@ -9,2 +9,4 @@
 
 ADD_LIBRARY( ceguilua_orxonox SHARED ${LUA_SRC_FILES} )
+
+TARGET_LINK_LIBRARIES( ceguilua_orxonox lua_orxonox )
Index: code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/lua_CEGUI.cpp
===================================================================
--- code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/lua_CEGUI.cpp	(revision 1803)
+++ code/branches/ceguilua/src/ceguilua-0.6.1/ceguilua/lua_CEGUI.cpp	(revision 1804)
@@ -9,5 +9,5 @@
 #include "string.h"
 
-#include "tolua++.h"
+#include "tolua/tolua++.h"
 
 /* Exported function */
Index: code/branches/ceguilua/src/core/CMakeLists.txt
===================================================================
--- code/branches/ceguilua/src/core/CMakeLists.txt	(revision 1803)
+++ code/branches/ceguilua/src/core/CMakeLists.txt	(revision 1804)
@@ -65,10 +65,10 @@
 
 TARGET_LINK_LIBRARIES(core
-  ${Lua_LIBRARIES}
   ${OGRE_LIBRARIES}
-  cpptcl
+  lua_orxonox
+  cpptcl_orxonox
   ois_orxonox
-  tinyxml
-  tolualib
+  tinyxml_orxonox
+  tolualib_orxonox
   util
   ${Boost_thread_LIBRARIES}
Index: code/branches/ceguilua/src/core/Script.cc
===================================================================
--- code/branches/ceguilua/src/core/Script.cc	(revision 1803)
+++ code/branches/ceguilua/src/core/Script.cc	(revision 1804)
@@ -34,8 +34,5 @@
 #include "CoreIncludes.h"
 
-extern "C" {
-#include <lualib.h>
-#include <lauxlib.h>
-}
+#include "lua/lua.hpp"
 
 #include "tolua/tolua++.h"
Index: code/branches/ceguilua/src/core/Script.h
===================================================================
--- code/branches/ceguilua/src/core/Script.h	(revision 1803)
+++ code/branches/ceguilua/src/core/Script.h	(revision 1804)
@@ -39,5 +39,5 @@
 
 extern "C" {
-#include <lua.h>
+#include "lua/lua.h"
 }
 
Index: code/branches/ceguilua/src/cpptcl/CMakeLists.txt
===================================================================
--- code/branches/ceguilua/src/cpptcl/CMakeLists.txt	(revision 1803)
+++ code/branches/ceguilua/src/cpptcl/CMakeLists.txt	(revision 1804)
@@ -1,5 +1,5 @@
-ADD_LIBRARY(cpptcl SHARED CppTcl.cc)
+ADD_LIBRARY(cpptcl_orxonox SHARED CppTcl.cc)
 
-TARGET_LINK_LIBRARIES(cpptcl
+TARGET_LINK_LIBRARIES(cpptcl_orxonox
   ${TCL_LIBRARY}
 )
Index: code/branches/ceguilua/src/lua-5.0.3/lua/lua.hpp
===================================================================
--- code/branches/ceguilua/src/lua-5.0.3/lua/lua.hpp	(revision 1804)
+++ code/branches/ceguilua/src/lua-5.0.3/lua/lua.hpp	(revision 1804)
@@ -0,0 +1,9 @@
+// lua.hpp
+// Lua header files for C++
+// <<extern "C">> not supplied automatically because Lua also compiles as C++
+
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
Index: code/branches/ceguilua/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/ceguilua/src/orxonox/CMakeLists.txt	(revision 1803)
+++ code/branches/ceguilua/src/orxonox/CMakeLists.txt	(revision 1804)
@@ -97,9 +97,9 @@
 TARGET_LINK_LIBRARIES( orxonox
   ${OGRE_LIBRARIES}
-  ${Lua_LIBRARIES}
   ${CEGUI_LIBRARIES}
   ${CEGUI_SCRIPT_LIBRARIES}
-  tinyxml
-  tolualib
+  lua_orxonox
+  tinyxml_orxonox
+  tolualib_orxonox
   ois_orxonox
   util
Index: code/branches/ceguilua/src/orxonox/OrxonoxStableHeaders.h
===================================================================
--- code/branches/ceguilua/src/orxonox/OrxonoxStableHeaders.h	(revision 1803)
+++ code/branches/ceguilua/src/orxonox/OrxonoxStableHeaders.h	(revision 1804)
@@ -37,5 +37,5 @@
 #include "util/OrxonoxPlatform.h"
 
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && !defined(ORXONOX_DISABLE_PCH) && 0
+#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && !defined(ORXONOX_DISABLE_PCH)
 
 // including std headers here is useless since they're already precompiled
Index: code/branches/ceguilua/src/orxonox/gui/GUIManager.cc
===================================================================
--- code/branches/ceguilua/src/orxonox/gui/GUIManager.cc	(revision 1803)
+++ code/branches/ceguilua/src/orxonox/gui/GUIManager.cc	(revision 1804)
@@ -39,5 +39,5 @@
 #include <OgreRoot.h>
 #include <CEGUI.h>
-#include <CEGUILua.h>
+#include "ceguilua/CEGUILua.h"
 #include "util/Exception.h"
 #include "core/input/InputManager.h"
@@ -50,8 +50,5 @@
 #include "OgreCEGUIRenderer.h"
 
-extern "C" {
-#include <lualib.h>
-#include <lauxlib.h>
-}
+#include "lua/lua.hpp"
 
 namespace orxonox
Index: code/branches/ceguilua/src/tinyxml/CMakeLists.txt
===================================================================
--- code/branches/ceguilua/src/tinyxml/CMakeLists.txt	(revision 1803)
+++ code/branches/ceguilua/src/tinyxml/CMakeLists.txt	(revision 1804)
@@ -7,3 +7,3 @@
 )
 
-ADD_LIBRARY(tinyxml SHARED ${TINYXML_SRC_FILES})
+ADD_LIBRARY(tinyxml_orxonox SHARED ${TINYXML_SRC_FILES})
Index: code/branches/ceguilua/src/tolua/CMakeLists.txt
===================================================================
--- code/branches/ceguilua/src/tolua/CMakeLists.txt	(revision 1803)
+++ code/branches/ceguilua/src/tolua/CMakeLists.txt	(revision 1804)
@@ -7,8 +7,8 @@
 )
 
-ADD_LIBRARY (tolualib SHARED ${TOLUALIB_SRC_FILES})
+ADD_LIBRARY (tolualib_orxonox SHARED ${TOLUALIB_SRC_FILES})
 
-TARGET_LINK_LIBRARIES (tolualib
-  ${Lua_LIBRARIES}
+TARGET_LINK_LIBRARIES (tolualib_orxonox
+  lua_orxonox
 )
 
@@ -19,9 +19,9 @@
 )
 
-ADD_EXECUTABLE (toluagen ${TOLUAGEN_SRC_FILES})
+ADD_EXECUTABLE (toluagen_orxonox ${TOLUAGEN_SRC_FILES})
 
-TARGET_LINK_LIBRARIES (toluagen
-  ${Lua_LIBRARIES}
-  tolualib
+TARGET_LINK_LIBRARIES (toluagen_orxonox
+  lua_orxonox
+  tolualib_orxonox
   m
 )
@@ -34,9 +34,9 @@
 ENDIF (Lua_VERSION EQUAL 5.0)
 
-GET_TARGET_PROPERTY(TOLUAGEN_EXE toluagen LOCATION)
+GET_TARGET_PROPERTY(TOLUAGEN_EXE toluagen_orxonox LOCATION)
 ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/toluabind_orxonox.c
   COMMAND ${TOLUAGEN_EXE} -n tolua -o ../../src/tolua/toluabind_orxonox.c -H ../../src/tolua/toluabind_orxonox.h ${TOLUA_PACKAGE}
-  DEPENDS toluagen
+  DEPENDS toluagen_orxonox
   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib
 )
@@ -47,9 +47,9 @@
 )
 
-ADD_EXECUTABLE (tolua ${TOLUAEXE_SRC_FILES})
+ADD_EXECUTABLE (tolua_orxonox ${TOLUAEXE_SRC_FILES})
 
-TARGET_LINK_LIBRARIES (tolua
-  ${Lua_LIBRARIES}
-  tolualib
+TARGET_LINK_LIBRARIES (tolua_orxonox
+  lua_orxonox
+  tolualib_orxonox
   m
 )
Index: code/branches/ceguilua/src/tolua/lua/package.lua
===================================================================
--- code/branches/ceguilua/src/tolua/lua/package.lua	(revision 1803)
+++ code/branches/ceguilua/src/tolua/lua/package.lua	(revision 1804)
@@ -116,5 +116,5 @@
 	output('#endif\n')
 	output('#include "string.h"\n\n')
- output('#include "tolua++.h"\n\n')
+ output('#include "tolua/tolua++.h"\n\n')
 
  if not flags.h then
Index: code/branches/ceguilua/src/tolua/tolua++.h
===================================================================
--- code/branches/ceguilua/src/tolua/tolua++.h	(revision 1803)
+++ code/branches/ceguilua/src/tolua/tolua++.h	(revision 1804)
@@ -65,6 +65,6 @@
 typedef int lua_Object;
 
-#include "lua.h"
-#include "lauxlib.h"
+#include "lua/lua.h"
+#include "lua/lauxlib.h"
 
 struct tolua_Error
Index: code/branches/ceguilua/src/tolua/tolua.c
===================================================================
--- code/branches/ceguilua/src/tolua/tolua.c	(revision 1803)
+++ code/branches/ceguilua/src/tolua/tolua.c	(revision 1804)
@@ -15,7 +15,7 @@
 #include "tolua++.h"
 
-#include "lua.h"
-#include "lualib.h"
-#include "lauxlib.h"
+#include "lua/lua.h"
+#include "lua/lualib.h"
+#include "lua/lauxlib.h"
 
 #include <stdio.h>
Index: code/branches/ceguilua/src/tolua/tolua_is.c
===================================================================
--- code/branches/ceguilua/src/tolua/tolua_is.c	(revision 1803)
+++ code/branches/ceguilua/src/tolua/tolua_is.c	(revision 1804)
@@ -14,5 +14,5 @@
 
 #include "tolua++.h"
-#include "lauxlib.h"
+#include "lua/lauxlib.h"
 
 #include <stdlib.h>
Index: code/branches/ceguilua/src/tolua/tolua_map.c
===================================================================
--- code/branches/ceguilua/src/tolua/tolua_map.c	(revision 1803)
+++ code/branches/ceguilua/src/tolua/tolua_map.c	(revision 1804)
@@ -15,5 +15,5 @@
 #include "tolua++.h"
 #include "tolua_event.h"
-#include "lauxlib.h"
+#include "lua/lauxlib.h"
 
 #include <string.h>
Index: code/branches/ceguilua/src/tolua/tolua_push.c
===================================================================
--- code/branches/ceguilua/src/tolua/tolua_push.c	(revision 1803)
+++ code/branches/ceguilua/src/tolua/tolua_push.c	(revision 1804)
@@ -14,5 +14,5 @@
 
 #include "tolua++.h"
-#include "lauxlib.h"
+#include "lua/lauxlib.h"
 
 #include <stdlib.h>
