aboutsummaryrefslogtreecommitdiff
path: root/src/lua-nng-common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua-nng-common.h')
-rw-r--r--src/lua-nng-common.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/lua-nng-common.h b/src/lua-nng-common.h
index a56dd8a..ffdc4c7 100644
--- a/src/lua-nng-common.h
+++ b/src/lua-nng-common.h
@@ -1,6 +1,16 @@
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
-
-// lua runtime's traceback function
-int traceback (lua_State *L);
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
+
+/*
+Lua version independence 5.1+
+*/
+#ifndef luaL_newlib
+ #define luaL_newlib(l,r) luaL_register(l,NULL,r)
+#endif
+#ifndef luaL_setmetatable
+ #define luaL_setmetatable(l,s) luaL_getmetatable(l,s); lua_setmetatable(l,-2);
+#endif
+
+// lua runtime's traceback function
+int traceback (lua_State *L);