|
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'.= makemap {'a','b','c'}{a=1,c=3,b=2}= makemap ({'a','b','c'},{1,2,3}){a=1,c=3,b=2} It still does fine as a set-maker, but has other superpowers as well! It turns out that bind2 is very useful, since many Lua functions have the table or string as their first argument. imap2 sneaked in as well. I am not convinced that this is the best name, maybe llib or lualib is better. I still want to use Moonlight for a project name, but maybe I should keep that back. The readme.md is fairly extensive, and hopefully covers most of the ground. steve d. 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.
|