lua-users home
lua-l archive

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


Metalua has a fairly complete options parser, accessible here:

http://github.com/fab13n/metalua/tree/master/src/lib/metalua/clopts.mlua

It uses some metalua extensions, so if you want to use it without metalua you'll have to either use the bytecode-compiled version (which is lua compatible), or to backport parts of it in plain Lua.

It handles short options (-a, +a, -ab is the same as -a -b, etc.), long option names, typed option arguments, end-of-parsing token (-- by default as you expect), automated usage message generation. Unfortunately, the documentation is still "TODO", but you can look at a few samples below, and/or ask for assistance, by mail or on the metalua mailing list.

Program using clopts: 
http://github.com/fab13n/metalua/tree/master/src/samples/metalint/metalint.mlua from line 270
http://github.com/fab13n/metalua/tree/master/src/compiler/metalua.mlua from line 39

mailing list: http://lists.luaforge.net/mailman/listinfo/metalua-list

-- Fabien.