lua: pass u64 blob type as double to Lua
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 13 Jan 2013 19:37:00 +0000 (20:37 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 13 Jan 2013 19:37:19 +0000 (20:37 +0100)
lua/ubus.c

index cbda37a5fd3e2dec65a4f1d58c0aa9717decba47..77624d73e38693ebaabedc3f351db763fba0421c 100644 (file)
@@ -67,7 +67,6 @@ ubus_lua_parse_blob(lua_State *L, struct blob_attr *attr, bool table)
        int len;
        int off = 0;
        void *data;
-       char buf[32];
 
        if (!blobmsg_check_attr(attr, false))
                return 0;
@@ -96,9 +95,7 @@ ubus_lua_parse_blob(lua_State *L, struct blob_attr *attr, bool table)
                break;
 
        case BLOBMSG_TYPE_INT64:
-               /* NB: Lua cannot handle 64bit, format value as string and push that */
-               sprintf(buf, "%lld", (long long int) be64_to_cpu(*(uint64_t *)data));
-               lua_pushstring(L, buf);
+               lua_pushnumber(L, (double) be64_to_cpu(*(uint64_t *)data));
                break;
 
        case BLOBMSG_TYPE_STRING: