Reinhard Kotucha <[email protected]> a écrit: > > On 2012-01-23 at 17:32:37 +0100, Paul Isambert wrote: > > > Herbert Voss <[email protected]> a écrit: > > > > > > Am 23.01.2012 15:47, schrieb Paul Isambert: > > > > > > >> \directlua{table.foreach(os.date("!*t"),function(...) > > > >> tex.print(tostring(...) end)} > > > >> \bye > > > > > > > > Or use a test like "type(<arg>) == 'boolean'". Note that table.foreach > > > > > > I alread had tostring() but I thought there might be > > > an easier solution. > > > > > > > is deprecated in Lua 5.1 and should be removed from 5.2 (see: > > > > http://lua-users.org/lists/lua-l/2010-11/msg00661.html). And LuaTeX > > > > > > oh, I like that ... :-( > > > > You can easily fake it: > > > > table.foreach = table.foreach or > > function (t, f) > > for k, v in pairs(t) do > > local ret = f(k, v) > > if ret then return ret end > > end > > end > > > > table.foreachi = table.foreach or > > function (t, f) > > for k, v in ipairs(t) do > > local ret = f(k, v) > > if ret then return ret end > > end > > end > > AFAIK, ipairs() is deprecated in Lua 5.2 too.
No, it's not, there even are new metamethods __ipairs and __pairs. See: http://www.lua.org/manual/5.2/readme.html#changes (You frightened me for a second.) Paul
