va_end (ap);
return true;
-}
\ No newline at end of file
+}
+
+#if defined( LUA_VERSION_NUM ) && LUA_VERSION_NUM <= 502
+gint
+rspamd_lua_geti (lua_State *L, int pos, int i)
+{
+ pos = lua_absindex (L, pos);
+ lua_pushinteger (L, i);
+ lua_gettable (L, pos);
+
+ return lua_type (L, -1);
+}
+#endif
\ No newline at end of file
bool rspamd_lua_universal_pcall (lua_State *L, gint cbref, const gchar* strloc,
gint nret, const gchar *args, GError **err, ...);
+/**
+ * Wrapper for lua_geti from lua 5.3
+ * @param L
+ * @param index
+ * @param i
+ * @return
+ */
+#if defined( LUA_VERSION_NUM ) && LUA_VERSION_NUM <= 502
+gint rspamd_lua_geti (lua_State *L, int index, int i);
+#else
+#define rspamd_lua_geti lua_geti
+#endif
+
/* Paths defs */
#define RSPAMD_CONFDIR_INDEX "CONFDIR"
#define RSPAMD_LOCAL_CONFDIR_INDEX "LOCAL_CONFDIR"