lua-users home
lua-l archive

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


I'm new to lua, so sorry if this has come up before or if 
it's a clueless idea.  I would like to be able to use an 
arbitary expression to the left of a `:' or `.', for 
example something like this:

    m3 = (m1 * m2):invert()

Which now results in the error message:

    lua error: unexpected token;
      last token read: `:' at line 1 in file `test.lua'

This came up while working on a lua interface to a matrix 
library.  Here m1 and m2 are user data (pointing to matrices).  
Matrices have a tag method for mul which returns a product matrix 
and they have a tag method for gettable that returns a matrix 
inversion method for the index "invert".  It all works well, 
but I'd like to be able to do complex matrix operations 
without resorting to the use of temporary variables.  Is there 
an elegant alternative to the above syntax?

Dave
--
Algorithmic Arts Inc., Tokyo, Japan
www:    http://www.algorithmic.com/