Page 1 of 1

How to pass a matrix to lua?

Posted: Fri Nov 21, 2008 8:58 pm
by unholysavagery
My engine needs control over matrices but if I pass a pointer it will create a new matrix every time I multiply it. So I need to push the actual matrix but I don't know how to push an array on to the stack.

Any ideas? Do I push each element of it?

Re: How to pass a matrix to lua?

Posted: Fri Nov 21, 2008 11:57 pm
by Falco Girgis
Yeah, you're going to have to use some sort of 2-layer loop if you're pushing and popping from the stack. I would recommend doing something like pass by reference, but I'm not good enough at working with raw Lua userdata without going through toLua++ to say anything on the matter.