lua-users home
lua-l archive

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


On Fri, Jun 29, 2007 at 05:50:27PM +0200, John McKenna wrote:
> Why do we want multiple values?  We decided that the nicest interface to
> our ugly C++ code is through properties (yes, there's an ex-Delphi
> programmer on the team):
> 
> object.position = otherObject.position
> 
> ends up calling C++ functions to get and set the position.  Then someone
> decided that the state of a controller button (we do console games) was
> best expressed with two values: state (it has just been pressed, it is
> still being pressed, it has just been released, etc) and pressure:
> 
> state, pressure = controller.button
> 
> These are the multiple values we want to return from __index.

Any real reason you don't want to write:
  state, pressure = controller.button()

or
  state = controller.button.state
  pressure = controller.button.pressure

  OG.