goto error;
switch (n) {
+ case 4:
case 3:
ptr->option = luaL_checkstring(L, 3);
/* fall through */
goto error;
break;
default:
+ luaL_error(L, "invalid argument count");
goto error;
}
struct uci_element *e;
lua_newtable(L);
+ lua_pushboolean(L, s->anonymous);
+ lua_setfield(L, -2, ".anonymous");
lua_pushstring(L, s->type);
lua_setfield(L, -2, ".type");
lua_pushstring(L, s->e.name);
err = UCI_ERR_INVAL;
goto error;
}
+ if (!(ptr.flags & UCI_LOOKUP_COMPLETE)) {
+ err = UCI_ERR_NOTFOUND;
+ goto error;
+ }
err = UCI_OK;
e = ptr.last;
if (err)
goto error;
- if ((ptr.s == NULL) || (ptr.value == NULL)) {
+ if (((ptr.s == NULL) && (ptr.option != NULL)) || (ptr.value == NULL)) {
err = UCI_ERR_INVAL;
goto error;
}
}
static int
+uci_lua_get_confdir(lua_State *L)
+{
+ lua_pushstring(L, ctx->confdir);
+ return 1;
+}
+
+static int
uci_lua_set_confdir(lua_State *L)
{
int ret;
}
static int
+uci_lua_get_savedir(lua_State *L)
+{
+ lua_pushstring(L, ctx->savedir);
+ return 1;
+}
+
+static int
uci_lua_set_savedir(lua_State *L)
{
int ret;
{ "revert", uci_lua_revert },
{ "changes", uci_lua_changes },
{ "foreach", uci_lua_foreach },
+ { "get_confdir", uci_lua_get_confdir },
{ "set_confdir", uci_lua_set_confdir },
+ { "get_savedir", uci_lua_get_savedir },
{ "set_savedir", uci_lua_set_savedir },
{ NULL, NULL },
};