Index: code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/CEGUILua.cpp
===================================================================
--- code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/CEGUILua.cpp	(revision 1980)
+++ code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/CEGUILua.cpp	(revision 1982)
@@ -28,4 +28,7 @@
  *   OTHER DEALINGS IN THE SOFTWARE.
  ***************************************************************************/
+#ifdef HAVE_CONFIG_H
+#   include "config.h"
+#endif
 
 #include "CEGUI.h"
@@ -37,6 +40,11 @@
 
 // include Lua libs and tolua++
-#include "lua/lua.hpp"
-#include "tolua/tolua++.h"
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua++.h"
 
 // prototype for bindings initialisation function
@@ -53,17 +61,19 @@
 LuaScriptModule::LuaScriptModule()
 {
-    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}
-    };
+    #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 */
 
     // create a lua state
@@ -72,11 +82,22 @@
 
     // init all standard libraries
-    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);
-    }
+    #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 */
 
     setModuleIdentifierString();
Index: code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/CEGUILua.h
===================================================================
--- code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/CEGUILua.h	(revision 1980)
+++ code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/CEGUILua.h	(revision 1982)
@@ -31,5 +31,5 @@
 #define _CEGUILua_h_
 
-/*** CHANGES BY ORXONOX TEAM FOR MINGW32 ***/
+
 /*************************************************************************
 	Import / Export control macros
@@ -39,9 +39,5 @@
 #       define CEGUILUA_API __declspec(dllexport)
 #   else
-#      if defined( __MINGW32__ )
-#          define CEGUILUA_API
-#      else
-#          define CEGUILUA_API __declspec(dllimport)
-#      endif
+#       define CEGUILUA_API __declspec(dllimport)
 #   endif
 #else
Index: code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp
===================================================================
--- code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp	(revision 1980)
+++ code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp	(revision 1982)
@@ -34,6 +34,11 @@
 
 // include Lua libs and tolua++
-#include "lua/lua.hpp"
-#include "tolua/tolua++.h"
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua++.h"
 
 // Start of CEGUI namespace section
Index: code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/lua_CEGUI.cpp
===================================================================
--- code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/lua_CEGUI.cpp	(revision 1980)
+++ code/branches/buildsystem/src/ceguilua-0.6.1/ceguilua/lua_CEGUI.cpp	(revision 1982)
@@ -9,5 +9,5 @@
 #include "string.h"
 
-#include "tolua/tolua++.h"
+#include "tolua++.h"
 
 /* Exported function */
