I can work around this by adding a temporary on_tick listener[1], but it would be nice if the event only fired after the inventory was fully settled.
[1] my workaround:
Code: Select all
script.on_event(defines.events.on_player_main_inventory_changed, function(event)
-- inventory not sorted yet
local player = game.players[event.player_index]
script.on_event(defines.events.on_tick, function(event)
-- now inventory is sorted and won't change out from under us
script.on_event(defines.events.on_tick, nil)
updateInventoryInfo(player)
end)
end)