|
|
||
|
On 2012-02-18 18:54, steve donovan wrote:
On Fri, Feb 17, 2012 at 8:40 AM, Xavier Wang <weasley.wx@gmail.com> wrote:It's must a great module of lua!Since people have said such nice things to me I've made a new version, at a more convenient home: https://github.com/stevedonovan/Microlight Some things have not made the cut, like tmap (mapping over lists is much more common) and intersect. I've also left out the safe/throw function wrappers since it's an unusual usage. The table dumper generates prettier output, but at the cost of guaranteeing good serialized output (e.g. {function=true}). Mostly intended as a debug aid at this point. 'update' is now called 'import', and without a second argument it imports ml itself. If the second arg is a string, it tries to use require() (thanks to Dirk for this suggestion)require 'ml'.import() import(_G,"lfs")(there's a little overloading going on here which I'm not sure about. 'set' is still there, but now called 'makemap'. I think you are on to something. I really hope that microlight can mature into lualib, auxlib or whatever. I think that would be good for Lua. Penlight is a bit large to pull into every small rogram. But microlight is of a sensible size, something I like to use in small programs. I have not digested microlight yet, so I have only two comments now: ml.escape documentation: escapes magic characters in _Lua string patterns_. I did not understand that immediately, escaping is very context dependent. Usage suggestion: string.find('a[%]', ml.escape'[%]') ml.tstring , ml.tdump does not make sense to me if they do not have pretty print option (as default). I would rather leave out the {a=1} vs {'a'=1} logic, if you want prioritize code size.
|