From bf566871bd6a633e4504c60c6fc55b2a97305a50 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 13 Jan 2013 20:37:00 +0100 Subject: [PATCH 1/1] lua: pass u64 blob type as double to Lua --- lua/ubus.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/ubus.c b/lua/ubus.c index cbda37a..77624d7 100644 --- a/lua/ubus.c +++ b/lua/ubus.c @@ -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: -- 2.11.0