lua-users home
lua-l archive

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


Am 23.09.13 11:04, schrieb Rena:
>     2013/9/17 Sean Conner <sean@conman.org <mailto: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
> 
> 
> I'd go one step further and do: syslog.notice("The foo is %s", status)
> which incidentally happens to be exactly the interface for a log library
> I wrote a while ago.

Good idea, really.  I guess my unix binding will use thise, too, quite
soon ;)


> 
> 
> -- 
> Sent from my Game Boy.