case LUA_TINT:
#endif
case LUA_TNUMBER:
- blobmsg_add_u32(b, key, (uint32_t)lua_tointeger(L, -1));
+ if ((uint64_t)lua_tonumber(L, -1) > INT_MAX)
+ blobmsg_add_u64(b, key, (uint64_t)lua_tonumber(L, -1));
+ else
+ blobmsg_add_u32(b, key, (uint32_t)lua_tointeger(L, -1));
break;
case LUA_TSTRING:
{
int rv;
struct ubus_lua_connection *c = luaL_checkudata(L, 1, METANAME);
+ const char *path = (lua_gettop(L) >= 2) ? luaL_checkstring(L, 2) : NULL;
lua_newtable(L);
- rv = ubus_lookup(c->ctx, NULL, ubus_lua_objects_cb, L);
+ rv = ubus_lookup(c->ctx, path, ubus_lua_objects_cb, L);
if (rv != UBUS_STATUS_OK)
{
if( idxremove ){
lua_getglobal(L, "__ubus_cb_subscribe");
- lua_pushvalue(L, idxnotify);
- sub->rnotify = luaL_ref(L, -2);
+ lua_pushvalue(L, idxremove);
+ sub->rremove = luaL_ref(L, -2);
lua_pop(L, 1);
sub->s.remove_cb = ubus_sub_remove_handler;
}