diff mbox

[LEDE-DEV] Pass method paraneter to Lua notifications.

Message ID 1465653272-29005-1-git-send-email-iainf@netduma.com
State Changes Requested
Headers show

Commit Message

Iain Fraser June 11, 2016, 1:54 p.m. UTC
---
 lua/ubus.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

John Crispin June 13, 2016, 5 a.m. UTC | #1
Hi Ian,

there is a typo in the subject and the description of the patch is
missing in the body. could you please fix those 2 things and resend the
patch ?

	Johb

On 11/06/2016 15:54, Iain Fraser wrote:
> ---
>  lua/ubus.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lua/ubus.c b/lua/ubus.c
> index f59af90..be54d8d 100644
> --- a/lua/ubus.c
> +++ b/lua/ubus.c
> @@ -770,11 +770,12 @@ ubus_sub_notify_handler(struct ubus_context *ctx, struct ubus_object *obj,
>  	lua_remove(state, -2);
>  
>  	if (lua_isfunction(state, -1)) {
> +		lua_pushstring(state, method);
>  		if( msg ){
>  			ubus_lua_parse_blob_array(state, blob_data(msg), blob_len(msg), true);
> -			lua_call(state, 1, 0);
> +			lua_call(state, 2, 0);
>  		} else {
> -			lua_call(state, 0, 0);
> +			lua_call(state, 1, 0);
>  		}
>  	} else {
>  		lua_pop(state, 1);
>
diff mbox

Patch

diff --git a/lua/ubus.c b/lua/ubus.c
index f59af90..be54d8d 100644
--- a/lua/ubus.c
+++ b/lua/ubus.c
@@ -770,11 +770,12 @@  ubus_sub_notify_handler(struct ubus_context *ctx, struct ubus_object *obj,
 	lua_remove(state, -2);
 
 	if (lua_isfunction(state, -1)) {
+		lua_pushstring(state, method);
 		if( msg ){
 			ubus_lua_parse_blob_array(state, blob_data(msg), blob_len(msg), true);
-			lua_call(state, 1, 0);
+			lua_call(state, 2, 0);
 		} else {
-			lua_call(state, 0, 0);
+			lua_call(state, 1, 0);
 		}
 	} else {
 		lua_pop(state, 1);