lua-users home
lua-l archive

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


 >> > Have you considered just writing a little C code to bind the C
 >> > library's getopt?  
 >>
 >> It trivial to implement getopt_long in LUA. I did it for AWK some time
 >> ago, ~150 lines of code. Also the problem with C code is that
 >> getopt_long(3) is not available on Solaris/HP-UX and some
 >> others. getopt_long(3) is not portable.

> Surely getopt_long is not POSIX, however?  I'm confused about your
> requirements, here.

1) to be compatible with
   http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02
2) provide support for long options like *BSD and
   GNU libc getopt_long(3) functions do.
3) API of getopt_alt.lua looks very good.
   That is I like

    local opts = <prepare things somehow>
    for k, v in pairs(opts) do
       print( k, v )
    end

> Also: Lua is not an acronym, and thus should be capitalised as a
> proper-noun :)
ok

-- 
Best regards, Aleksey Cheusov.