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

Jo-Philipp Wich jow at openwrt.org
Fri Nov 20 08:45:41 EST 2015


Hi,

yeah right - made a mistake. The first argument to ubus.connect() is the
socket path and the second one is the timeout in ms.

Pass nil as 1st arg to use the default path and the desired timeout as
2nd one:

conn = ubus.connect(nil, 1000)

~ Jow

> 
> On Fri, Nov 20, 2015 at 6:58 PM, Jo-Philipp Wich <jow at openwrt.org
> <mailto:jow at openwrt.org>> wrote:
> 
>     Hi.
> 
>     > 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).
> 
>     Simply pass a table with your arguments as 3rd argument:
> 
>       conn:call(object, function, { arg_1 = foo, arg_2 = bar })
> 
>     You cannot set timeouts per call but you can specify them globally by
>     passing the amount of milliseconds to the ubus.connect() call.
> 
>     E.g. conn = ubus.connect(1000) to have an 1s timeout on all calls.
> 
>     ~ Jow
>     _______________________________________________
>     openwrt-devel mailing list
>     openwrt-devel at lists.openwrt.org <mailto:openwrt-devel at lists.openwrt.org>
>     https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> 
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list