[OpenWrt-Devel] Syntax to call ubus registered function (having arguments) from lua

Pratik Prajapati pratik.prajapati12 at gmail.com
Fri Nov 20 07:55:13 EST 2015


I am trying to call a function registered on ubus from lua script. I know
how to call a argument less function but don't know the syntax of a
function with args (also how to add ubus timeout).

My lua script snippet:

require "ubus"
local conn = ubus.connect()

local status_1 = conn:call("my_interface", "fun_1", {})                --[[
this is working fine ]]--

local status_2 = conn:call("my_interface", "fun_2", {arg_1 = "hello", arg_2
= "12"})    --[[ not sure whether this works ]]--

In second call I also want to add ubus timeout option. I also checked for
the same in ubus repository (https://github.com/commodo/ubus) but didn't
found any example.

Can somebody tell me how to add ubus timeout in ubus call from lua ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20151120/86496bb0/attachment.htm>
-------------- next part --------------
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list