int len;
int off = 0;
void *data;
- char buf[32];
if (!blobmsg_check_attr(attr, false))
return 0;
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:
if (lua_type(L, -2) != LUA_TNUMBER)
#endif
{
- lua_pop(L, 1);
+ lua_pop(L, 2);
return false;
}
if ((cur - 1) != prv)
{
- lua_pop(L, 1);
+ lua_pop(L, 2);
return false;
}
if (lua_isfunction(state, -1)) {
lua_pushlightuserdata(state, req);
- lua_call(state, 1, 0);
+ if (!msg)
+ lua_pushnil(state);
+ else
+ ubus_lua_parse_blob_array(state, blob_data(msg), blob_len(msg), true);
+ lua_call(state, 2, 0);
}
return 0;
}