lua-users home
lua-l archive

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

> : I also had to dig into the sources a little deeper, because I need
> a version of foreach which has repeatable order also for string indices.

What about this? Too slow?

  function foreachsorted (t, f)
    local a = {}
    foreach(t, function(name) tinsert(%a, name) end)
    foreachi(a, function (i, n) %f(n, %t[n]) end)

> > * below is a program that screws up the internal Lua-Stack. Doesn't look
> >   really dangerous, does it?

Somewhere in the list (around May, I guess) there is a one-line patch
for it.

-- Roberto