Hi Jow, Thanks for looking at my patches.
On Wed, Jul 11, 2012 at 9:29 PM, Jo-Philipp Wich <x...@subsignal.org> wrote: > The LuCI patch will not properly work that way, OpenWrt Lua does not > handle numeric integer values > 2^31 bit. A somewhat larger range can be > stored as float but the precision is not enough: I have tested the patches on my router and they do indeed allow values greater than 32 bit. The way I understand it Lua only supports one number format and the default type at compile time is double precision floating point. (As I have seen my patch working I assume OpenWrt uses floating for the Lua number type.) However, the interface to the C world only supports 32 bit integers for numbers. The ubus-2012-06-01/lua/ubus.c file contains the following: 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); break; I assume this is the code that eventually gets used when I called the blobmsg_add_u64 function in netifd to pass the stats values to luci via ubus. Therefore lua actually receives the 64 bit number as a string. I passed this string to tonumber(x) which converts the string directly to a double. A double should be able to handle up to I think a 52 bit integer exactly and go even larger with some error. Kevin _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel