I've searched the luci repo for ubus and found two ways it's being used by current code:
and
In ash I do: echo "$(ubus call service list "{\"name\": \"${packageName}\"}" | jsonfilter -l1 -e "@['${packageName}']['instances']['status']['data']['status']")", how do I do the same in lua/luci app?
Thanks!
Solution: do not use local for variable declarations in lua console.
Both wiki approach and using luci.util.ubus work. I ended up doing this:
local util = require "luci.util"
local serviceName = "myService"
local status = util.ubus('service', 'list', { name = serviceName })[serviceName]['instances']['status']['data']['status'] or "Stopped"