Commit graph

23 commits

Author SHA1 Message Date
Vasily Goldobin
d009a08473 lua: add 'defer_request' and 'complete_deferred_request' functions
Add Lua bindings for 'ubus_defer_request' and 'ubus_complete_deferred_request' functions with sample code.

Signed-off-by: Vasily Goldobin <vasily@lynxtech.ru>
2016-11-21 11:27:05 +01:00
Iain Fraser
976719d89c Implemented publish/subscribe lua bindings to libubus-lua with example lua files. 2016-06-06 14:47:10 +02:00
Felix Fietkau
8bb34756ce lua: fix stack leak in ubus method handling
Signed-off-by: Chen Bin <ewolfok@126.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-20 14:59:06 +01:00
Hans Dedecker
d23b07a9ff lua: Fix stack imbalance in ubus_event_handler
The value from getglobal wasn't being removed from the stack,
resulting in an ever growing stack in the ubus event handler.

Signed-off-by: Karl Vogel <karl.vogel@gmail.com>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2015-11-02 19:02:35 +01:00
陈斌
f361bfa5fc lua: fix memory leak problem
Signed-off-by: Chen Bin <ewolfok@126.com>
2015-05-25 23:06:19 +02:00
Hans Dedecker
7798d56301 ubus: Fix issues reported by static code analysis tool Klocwork
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2015-04-20 15:43:19 +02:00
Steven Barth
6dffecb36b lua: forward return codes from lua to ubus
Signed-off-by: Steven Barth <cyrus@openwrt.org>
Tested-by: Luka Perkov <luka@openwrt.org>
2014-05-05 19:56:31 +02:00
Karl Vogel
334c389180 ubus: Fix imbalance in lua stack push/pop of values.
The lua getglobal and rawgeti both push a value onto the lua stack,
but they weren't being removed by the ubus_method_handler function,
thus corrupting the lua stack.

In case the specified method wasn't a function, the stack was also
corrupted as the method name remained on the stack.

Signed-off-by: Karl Vogel <karl.vogel@gmail.com>
2014-02-23 18:20:29 +01:00
Luka Perkov
4e82a1fabb lua: allow methods with no arguments
In C it is possible to have methods without arguments (UBUS_METHOD_NOARG).
Enable support for the same calls in Lua too.

This commit also fixes segfault which can be caused by passing non-table type
where table is expected. The lua_gettablelen() function is called after we have
made sure we are dealing with a table in the first place.

Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-01-28 22:20:30 +00:00
Luka Perkov
b356773921 lua: fix whitespaces and typo
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-01-28 22:20:26 +00:00
John Crispin
8ea9667036 add Lua bindings for ubus events
It mostly mimick the style of the existing code.

With it and the ubox Lua bindings, you can now send ubus events
through Lua or listen for events (you can register for multiple events
at the same time).

Signed-off-by: Jeff Remy <jeff.remy@gmail.com>
2013-11-07 16:23:30 +01:00
Thomas Gstädtner
a15a09aed4 add INCLUDE_DIRECTORIES to subdirectories 2013-03-03 03:43:22 +01:00
Jo-Philipp Wich
bf566871bd lua: pass u64 blob type as double to Lua 2013-01-13 20:37:19 +01:00
Jo-Philipp Wich
77eefb3bdd lua: remove a superfluous lua_pop() when checking table style 2012-10-17 15:32:26 +02:00
Jo-Philipp Wich
9c0b821573 lua: fix ubus_lua_format_blob_is_array() to not leave garbage on the stack 2012-10-16 19:37:31 +03:00
John Crispin
0f793d3a45 lua: propagate incoming message to method callback inside the lua context
Signed-off-by: John Crispin <blogic@openwrt.org>
2012-09-29 01:41:09 +02:00
John Crispin
73380e45c9 add lua binding test scripts
Signed-off-by: John Crispin <blogic@openwrt.org>
2012-09-27 14:05:51 +02:00
Felix Fietkau
c382792d98 lua: add support for registering methods
Signed-off-by: John Crispin <blogic@openwrt.org>
2012-09-27 14:00:49 +02:00
Felix Fietkau
0371c8f5fd lua: add uloop support 2012-09-27 13:59:47 +02:00
John Crispin
115b7a8c73 lua: allow building the lua binding with vanilla lua
Signed-off-by: John Crispin <blogic@openwrt.org>
2012-09-27 13:49:45 +02:00
Felix Fietkau
960c342b4a lua: add a prototype for luaopen_ubus so that -Wmissing-declarations can be enabled 2012-05-29 00:41:27 +02:00
Felix Fietkau
a204ae358b lua: put LUAPATH in quotes to prevent weird error messages when it is unset 2012-05-06 10:25:46 +02:00
Jo-Philipp Wich
25b9b4b827 implement Lua binding 2012-05-05 22:37:46 +02:00