lua-users home
lua-l archive

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





2013/9/17 Sean Conner <sean@conman.org>

  Another thing I've found (by doing Lua bindings by hand) is that a
mechanical approach really doesn't make for good Lua bindings.  Such a
mechanial approach to syslog() would end up with:

        syslog(5,string.format("The foo is %s",status))

Or ...

        LOG_NOTICE = 5
        syslog(LOG_NOTICE,string.format("The foo is %s",status))

Or

        syslog("LOG_NOTICE",string.format("The foo is %s",status))

Doing it by hand, I did [1]:

        syslog('notice',"The foo is %s",status)

which is MUCH nicer (IMHO) than other syslog() interfaces for Lua I've seen.

  -spc

[1]     https://github.com/spc476/lua-conmanorg/blob/master/src/syslog.c



It's true. I tried to map some OpenGL functions into Lua. It requires really flexible discretion to decide among multiple return, or return in tuple; vararg, or table argument, or merge several functions into a single Lua API. Not a mechanic approach being able to handle.