lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



The order of the enumeration is unspecified and may change when new keys
are added during the enumeration, skipping some keys or returning them
multiple times, potentially infinitely if the modification continues.

If keys are removed it could raise `invalid key to 'next'` too.

As following code did for me:

local tab = {a=1,b=2}

for k, v in pairs(tab) do
    tab[k] = nil
    tab[k .. "other"] = v
end

Regards,
Xmilia