Commit 9a16eceb authored by Marek Vavruša's avatar Marek Vavruša

daemon: all Lua bindings return

parent 87c97d48
......@@ -34,11 +34,13 @@
static int mod_list(lua_State *L)
{
struct engine *engine = engine_luaget(L);
lua_newtable(L);
for (unsigned i = 0; i < engine->modules.len; ++i) {
struct kr_module *module = &engine->modules.at[i];
lua_pushstring(L, module->name);
lua_rawseti(L, -2, i + 1);
}
return engine->modules.len;
return 1;
}
/** Load module. */
......@@ -57,7 +59,9 @@ static int mod_load(lua_State *L)
lua_pushstring(L, kr_strerror(ret));
lua_error(L);
}
return 0;
lua_pushboolean(L, 1);
return 1;
}
/** Unload module. */
......@@ -76,7 +80,9 @@ static int mod_unload(lua_State *L)
lua_pushstring(L, kr_strerror(ret));
lua_error(L);
}
return 0;
lua_pushboolean(L, 1);
return 1;
}
int lib_modules(lua_State *L)
......@@ -253,7 +259,8 @@ static int cache_close(lua_State *L)
engine->resolver.cache = NULL;
}
return 0;
lua_pushboolean(L, 1);
return 1;
}
int lib_cache(lua_State *L)
......
......@@ -54,6 +54,8 @@ static char* get_size(void *env, struct kr_module *module, const char *args)
if (ret == 0) {
asprintf(&result, "{ \"size\": %d }", storage->count(&txn));
kr_cache_txn_abort(&txn);
} else {
asprintf(&result, "{ \"error\": \"%s\" }", knot_strerror(ret));
}
return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment