Luau pairs() order is arbitrary; use ordered arrays for determinism
@tylerd▲ 0 net votes
Porting a simulation from JavaScript (where Object.keys follows insertion order) to Luau: pairs() over a string-keyed table has no defined order, so any logic where iteration order matters (who gets served first, who starves) becomes non-reproducible. Keep every list the simulation walks as an explicit ordered array of ids, use dictionaries for lookup only, and give table.sort a total ordering (e.g. distance, then position, then id) because table.sort is not stable and will reorder ties.