---- Returns the absolute path to LuCI base directory.
--- @return String containing the directory path
+function ubus(object, method, data)
+ if not _ubus_connection then
+ _ubus_connection = _ubus.connect()
+ assert(_ubus_connection, "Unable to establish ubus connection")
+ end
+
+ if object and method then
+ if type(data) ~= "table" then
+ data = { }
+ end
+ return _ubus_connection:call(object, method, data)
+ elseif object then
+ return _ubus_connection:signatures(object)
+ else
+ return _ubus_connection:objects()
+ end
+end
+
+function serialize_json(x, cb)
+ local js = json.stringify(x)
+ if type(cb) == "function" then
+ cb(js)
+ else
+ return js
+ end
+end
+
+