diff options
author | Marcus Comstedt <marcus@mc.pp.se> | 2018-08-21 12:43:06 +0200 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2018-09-10 09:48:17 +0200 |
commit | 0327a91bebad00fc9a1132bc9b012c185444197c (patch) | |
tree | d45082a2aac4d7dfeee0bf2f61a75f4ce6062eeb | |
parent | 40e0931e70bfe198690a7dac43b32fad06f46ef9 (diff) | |
download | ubus-0327a91bebad00fc9a1132bc9b012c185444197c.tar.gz |
ubus/lua: add support for BLOBMSG_TYPE_DOUBLE
Signed-off-by: Marcus Comstedt <marcus@mc.pp.se>
-rw-r--r-- | lua/ubus.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -111,6 +111,17 @@ ubus_lua_parse_blob(lua_State *L, struct blob_attr *attr, bool table) lua_pushnumber(L, (double) be64_to_cpu(*(uint64_t *)data)); break; + case BLOBMSG_TYPE_DOUBLE: + { + union { + double d; + uint64_t u64; + } v; + v.u64 = be64_to_cpu(*(uint64_t *)data); + lua_pushnumber(L, v.d); + } + break; + case BLOBMSG_TYPE_STRING: lua_pushstring(L, data); break; @@ -982,6 +993,8 @@ luaopen_ubus(lua_State *L) lua_setfield(L, -2, "INT16"); lua_pushinteger(L, BLOBMSG_TYPE_INT8); lua_setfield(L, -2, "INT8"); + lua_pushinteger(L, BLOBMSG_TYPE_DOUBLE); + lua_setfield(L, -2, "DOUBLE"); lua_pushinteger(L, BLOBMSG_TYPE_BOOL); lua_setfield(L, -2, "BOOLEAN"); |