Browse Source

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>
Etienne Champetier 2 years ago
parent
commit
2f793a4eb0
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lua/ubus.c

+ 2 - 1
lua/ubus.c

@@ -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)
 	{