The callback function registered to be invoked when subscribing to a
notification was only passed the notification data (if any) but not the name
of the notification.
This name is now passed as second argument to remain backwards compatible.
The example subscriber.lua has also be updated.
Signed-off-by: Dirk Feytons <dirk.feytons@gmail.com>
end
local sub = {
- notify = function( msg )
- print("Count: ", msg["count"])
+ notify = function( msg, name )
+ print("name:", name)
+ print(" count:", msg["count"])
end,
}
if (lua_isfunction(state, -1)) {
if( msg ){
ubus_lua_parse_blob_array(state, blob_data(msg), blob_len(msg), true);
- lua_call(state, 1, 0);
} else {
- lua_call(state, 0, 0);
+ lua_pushnil(state);
}
+ lua_pushstring(state, method);
+ lua_call(state, 2, 0);
} else {
lua_pop(state, 1);
}