Order of items of a table in a foreach

if I iterate over a table with a foreach, is there a guaranteed order in which they come out? FIFO?

No, this order is not guaranteed; it depends on the sequence of additions/removals as well as on the keys themselves. If you need a guaranteed iteration order, use an array.

Peter