lua-users home
lua-l archive

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

Thanks Roland and all,

i have already a solution on the C(++) side. As i said, it's basically
struct VECTOR {
with some methods around it for utility functions.

Would it be better to expose those functions to Lua or use a Lua-side library?
The Lua scripts would need to get some vectors in tables, then do some calculation with it and return a bunch of other vectors.

And concerning my other initial question, would it feel "right" for a Lua coder to handle a 2D vector as a Lua table with elements "x" and "y"?

On Wed, Jun 11, 2014 at 8:18 PM, Roland <> wrote:
Hi Lars,

I don't know if you are looking for a solution on the C-side, but I remember
I have some implementations of vector classes in pure Lua. They might not be
the best, but just quick modules I have written as part of some personal
See  vec3.lua
(used in Lua port of Smallpt raytracer) and  vector.lua
(2d vectors used in a simulation of steering behaviors).
There is also this quite complete and clean module for 2d vectors, which is
part of a larger set of utilities, named HUMP. See  hump.vector
<>  .
And last,  lua-vec <>  . I haven't tested
this out, though,  but the API looks quite complete.

View this message in context:
Sent from the Lua-l mailing list archive at