lua_setglobal (L, "rspamd_classifiers");
}
+ lua_getglobal (L, "classifiers");
+ if (lua_isnil (L, -1)) {
+ lua_newtable (L);
+ lua_setglobal (L, "classifiers");
+ }
+
lua_getglobal (L, "rspamd_version");
if (lua_isnil (L, -1)) {
lua_pushcfunction (L, rspamd_rcl_lua_version);
if (lua_type (L, -1) == LUA_TTABLE) {
lua_pushnil (L);
- while (lua_next (L, -1) != 0) {
+ while (lua_next (L, -2) != 0) {
lua_classifiers_cnt ++;
lua_pop (L, 1);
}
if (lua_type (L, -1) == LUA_TTABLE) {
lua_pushnil (L);
- while (lua_next (L, -1) != 0) {
+ while (lua_next (L, -2) != 0) {
lua_pushvalue (L, -2);
memcpy (&stat_ctx->classifiers_subrs[i], &lua_classifier,
sizeof (struct rspamd_stat_classifier));