lua-users home
lua-l archive

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

Hi all,

Inspired by Jay's challenge to keep it simple & stupid, I've come up
with thirty-odd functions that cover a lot of the general boilerplate
code we end up writing. 'Microlight' because it's the trimmed-down
younger brother of Penlight, about 500 lines in total, of which 160
are doc comments.

And the extracted docs are at

I was aiming at about 25 functions (which felt like a good number) but
naturally these things develop a momentum of their own; so I'm open to
dropping some to get something that fits nicely in the average head.

There is no 'shallow copy', but it's easy to make such a function.
extend(t,other) _extends_ an existing list-like table, and
update(t,other) _updates_ a map-like table with new key-value pairs.

icopy = bind1(extend,{})
tcopy = bind1(update,{})

There's also compose(), so that printf = compose(io.write,string.format).

There is a reasonably robust table dumper, but it's not pretty;
however it detects cycles and has a maximum-limit cut-off.

Not exhaustively tested - mostly culled from Penlight itself, which is
fairly well tested.  The aim in any case is to make an _executable
proposal_ for a group of straightforward functions.  It's particularly
hard to name things, so I need some help there.

(I threw in a reasonably brain-dead class implementation, just for luck)

steve d.