Module on_server_idle_reduce.lua
Reduce a table asynchronously using idle callbacks.
This helper uses on_server_idle.lua to process each element over multiple frames, preventing long-running loops from causing lag.
Functions
-
# returns... (tbl, on_item, Initial[, on_done]) -
Parameters
- tbl table Table to reduce.
- on_item
function
Reduction function
(acc, item) -> acc. - Initial acc accumulator value.
- on_done on_done Optional callback called with the final accumulator. (optional)
Returns
-
table
Job object with a
cancel()method.