On 1/28/2020 1:10 AM, Sebastian Miele wrote:
Moreover, e.g. the example
for n,key in next,table.sortedkeys(mixed) do io.write(string.format("[%2i] [%2s] (t:%6s) -> ā%sā\n", n, key, type(key), mixed[key])) end
from https://www.contextgarden.net/Table_manipulation returns different results at least on different runs.
you normally don't iterate over an array that way, compare: local t = { 11, "44", 22, "33" } for k, v in table.sortedhash(t) do print(k,v,type(k),type(v)) end local m = table.sortedkeys(t) for k, v in next, m do print(k,v,type(k),type(v)) end local m = table.sortedkeys(t) for k=1,#m do local v = t[k] print(k,v,type(k),type(v)) end Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------