aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_common.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-06-08 16:07:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-06-08 16:07:25 +0100
commit7cc8754ad93be42cf7cd6f1cba68621c93accf89 (patch)
tree7a433b3ae9ec12b73090afd874b2a12399277cee /src/lua/lua_common.h
parent4e4beec4cdfa633546a599823280af96b0b61bb7 (diff)
downloadrspamd-7cc8754ad93be42cf7cd6f1cba68621c93accf89.tar.gz
rspamd-7cc8754ad93be42cf7cd6f1cba68621c93accf89.zip
Adopt to lua 5.2.
Diffstat (limited to 'src/lua/lua_common.h')
-rw-r--r--src/lua/lua_common.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h
index 712a51062..f4985cb29 100644
--- a/src/lua/lua_common.h
+++ b/src/lua/lua_common.h
@@ -10,6 +10,27 @@
#include <lauxlib.h>
#include <lualib.h>
+#ifndef lua_open
+#define lua_open() luaL_newstate()
+#endif
+
+#ifndef luaL_reg
+#define luaL_reg luaL_Reg
+#endif
+
+#if LUA_VERSION_NUM > 501
+static inline void
+luaL_register (lua_State *L, const gchar *name, const struct luaL_reg *methods)
+{
+ lua_newtable (L);
+ luaL_setfuncs (L, methods, 0);
+ if (name != NULL) {
+ lua_pushvalue (L, -1);
+ lua_setglobal (L, name);
+ }
+}
+#endif
+
/* Interface definitions */
#define LUA_FUNCTION_DEF(class, name) static gint lua_##class##_##name(lua_State *L)
#define LUA_INTERFACE_DEF(class, name) { #name, lua_##class##_##name }