lua-users home
lua-l archive

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


On Fri, Dec 18, 2009 at 2:08 PM, steve donovan
<steve.j.donovan@gmail.com> > For any others who are interested, note
that metalua's table2.lua
> module is pure Lua, no extensions

http://github.com/fab13n/metalua/blob/master/src/lib/metalua/base.lua
http://github.com/fab13n/metalua/blob/master/src/lib/metalua/table2.lua

Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require 'metalua.base'
> require 'metalua.table2'
> d = table.print
> d {a=1,b=2;10,20}
{ a = 1, b = 2, 10, 20 }
> d(table.imap(string.upper,{'a','b'}))
{ "A", "B" }
> d(table.imap(function(s1,s2) return s1..s2 end,{'a','b'},{'1','2'}))
{ "a1", "b2" }

It's useful for users of the library to be able to give a fallback for
what 'callable' means. E.g. in Penlight, the string '..' standards for
the concatenation function above.

steve d.