lua-users home
lua-l archive

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


"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.