From: Steven Barth <[email protected]>

Signed-off-by: Steven Barth <[email protected]>
Tested-by: Luka Perkov <[email protected]>
---
 lua/ubus.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lua/ubus.c b/lua/ubus.c
index 0f2338c..4177d00 100644
--- a/lua/ubus.c
+++ b/lua/ubus.c
@@ -292,17 +292,21 @@ ubus_method_handler(struct ubus_context *ctx, struct 
ubus_object *obj,
        lua_remove(state, -2);
        lua_remove(state, -2);
 
+       int ret = 0;
+
        if (lua_isfunction(state, -1)) {
                lua_pushlightuserdata(state, req);
                if (!msg)
                        lua_pushnil(state);
                else
                        ubus_lua_parse_blob_array(state, blob_data(msg), 
blob_len(msg), true);
-               lua_call(state, 2, 0);
+               lua_call(state, 2, 1);
+               if (lua_isnumber(state, -1))
+                       ret = lua_tonumber(state, -1);
        } else
                lua_pop(state, 1);
 
-       return 0;
+       return ret;
 }
 
 static int lua_gettablelen(lua_State *L, int index)
-- 
1.9.2
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to