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
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.
Sent from my Game Boy.