lua-users home
lua-l archive

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


I'm a relatively new user of lua, but let me say from the start that it seems
like a very well done and useful bit of software.  I've done some mild 
experimenation with it, and in spite of (or maybe because of) its small size,
it has been remarkably easy to extend an application I've been working on to
use it.

I do have a couple of questions about how to use lua most effectively.  I have
a computer graphics application which passes vectors (4 floats) and homogeneous matrices (4x4 matrix of floats) around.  I'd like the user to be able to be able to create and manipulate these data structures in lua as well as in C.  For instance, I'd like to be able to write code that looks like:

m = matrix{1.0, 0.0, 0.0, 0.0, 
           0.0, 1.0, 0.0, 0.0, 
           0.0, 0.0, 1.0, 0.0, 
           0.0, 0.0, 0.0, 1.0} ;

v = vector{10.0, 3.0, 1.0} ;

newvec = m * v ;

Would it be best to make m and v user data objects, and tag them with types, then override the tag methods to check for these types prior to calling the original tag methods?   Or is there another, better way to go about this?

Thanks in advance...
		Mark <markv@pixar.com>