[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: help with lua style and syntax
- From: Brian Casiello <bcasiello@...>
- Date: Fri, 19 Oct 2012 11:42:30 -0400
"David Collier" <myshkin@cix.co.uk> writes:
>
> when I could write
>
> if( not( opened, localRs485SerialInstance =
> openSerialInstance(localRs485DeviceName))
> then
> print("program exiting - can't open local RS485 serial port
> "..localRs485DeviceName)
> return
> end
>
> I think the 2nd is more elegant.
If you don't mind encapsulating the function arguments in a table, you
could pass the table to openSerialInstance - it would update the appropriate
fields and returns the value for opened.
I'm not sure it's idiomatic Lua, but it would get you closer to the
syntax above.