Pārlūkot izejas kodu

Improve compatibility to Lua 5.1

Ole 10 gadi atpakaļ
vecāks
revīzija
3fc521313c

+ 0 - 1
examples/functions.cpp

@@ -1,4 +1,3 @@
-#include <lua.hpp>
 #include <luwra.hpp>
 
 #include <iostream>

+ 0 - 1
examples/stack.cpp

@@ -1,4 +1,3 @@
-#include <lua.hpp>
 #include <luwra.hpp>
 
 #include <iostream>

+ 0 - 1
examples/state.cpp

@@ -1,4 +1,3 @@
-#include <lua.hpp>
 #include <luwra.hpp>
 
 #include <string>

+ 0 - 1
examples/types.cpp

@@ -1,4 +1,3 @@
-#include <lua.hpp>
 #include <luwra.hpp>
 
 #include <iostream>

+ 0 - 1
examples/usertypes.cpp

@@ -1,4 +1,3 @@
-#include <lua.hpp>
 #include <luwra.hpp>
 
 #include <iostream>

+ 10 - 1
lib/luwra/common.hpp

@@ -12,13 +12,22 @@
 	#error You need a C++14 compliant compiler
 #endif
 
-#include <lua.hpp>
+extern "C" {
+	#include <lua.h>
+	#include <lualib.h>
+	#include <lauxlib.h>
+}
 
 // Check for proper Lua version
 #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 || LUA_VERSION_NUM >= 600
 	#error Luwra has not been tested against your installed version of Lua
 #endif
 
+// LUA_OK does not exist in Lua 5.1 and earlier
+#ifndef LUA_OK
+	#define LUA_OK 0
+#endif
+
 // Namespaces
 #define LUWRA_NS_BEGIN namespace luwra {
 #define LUWRA_NS_END }

+ 0 - 2
tests/auxiliary.cpp

@@ -1,6 +1,4 @@
 #include <catch.hpp>
-
-#include <lua.hpp>
 #include <luwra.hpp>
 
 TEST_CASE("equal") {

+ 0 - 2
tests/functions.cpp

@@ -1,6 +1,4 @@
 #include <catch.hpp>
-
-#include <lua.hpp>
 #include <luwra.hpp>
 
 static

+ 0 - 2
tests/stack.cpp

@@ -1,6 +1,4 @@
 #include <catch.hpp>
-
-#include <lua.hpp>
 #include <luwra.hpp>
 
 static

+ 0 - 2
tests/types.cpp

@@ -1,6 +1,4 @@
 #include <catch.hpp>
-
-#include <lua.hpp>
 #include <luwra.hpp>
 
 #include <cstring>

+ 0 - 2
tests/usertypes.cpp

@@ -1,6 +1,4 @@
 #include <catch.hpp>
-
-#include <lua.hpp>
 #include <luwra.hpp>
 
 #include <memory>