Weird lua table order bug (APFS related)? Bug in my code?

No, pairs will in some likelihood produce inconsistent results. Change that to ipairs and I will try later.