lua: add optional path filter to objects() method

'ubus list [<path>]' passes the path to ubusd,
this commit fix the lua bindings to do the same

Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
This commit is contained in:
Etienne Champetier 2022-05-01 17:58:09 -04:00 committed by Petr Štetiar
parent 584f56a233
commit 2f793a4eb0

View file

@ -286,9 +286,10 @@ ubus_lua_objects(lua_State *L)
{
int rv;
struct ubus_lua_connection *c = luaL_checkudata(L, 1, METANAME);
const char *path = (lua_gettop(L) >= 2) ? luaL_checkstring(L, 2) : NULL;
lua_newtable(L);
rv = ubus_lookup(c->ctx, NULL, ubus_lua_objects_cb, L);
rv = ubus_lookup(c->ctx, path, ubus_lua_objects_cb, L);
if (rv != UBUS_STATUS_OK)
{