---
extras/wip/filters/filter-lua/filter_lua.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/extras/wip/filters/filter-lua/filter_lua.c
b/extras/wip/filters/filter-lua/filter_lua.c
index 8d1d600..17152c5 100644
--- a/extras/wip/filters/filter-lua/filter_lua.c
+++ b/extras/wip/filters/filter-lua/filter_lua.c
@@ -28,6 +28,23 @@
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
+#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM == 501
+#define luaL_Reg luaL_reg
+void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
+ luaL_checkstack(L, nup+1, "too many upvalues");
+ for (; l->name != NULL; l++) { /* fill the table with given functions */
+ int i;
+ lua_pushstring(L, l->name);
+ for (i = 0; i < nup; i++) /* copy upvalues to the top */
+ lua_pushvalue(L, -(nup + 1));
+ lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
+ lua_settable(L, -(nup + 3)); /* table must be below the upvalues, the name
and the closure */
+ }
+ lua_pop(L, nup); /* remove upvalues */
+}
+#define luaL_newlib(L, l) \
+ (lua_newtable((L)),luaL_setfuncs((L), (l), 0))
+#endif
#include "smtpd-defines.h"
#include "smtpd-api.h"
--
2.4.2
--
You received this mail because you are subscribed to [email protected]
To unsubscribe, send a mail to: [email protected]