lua-users home
lua-l archive

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


> On Wed, Jun 11, 2014 at 9:32 AM, Lars Ruoff <lars.ruoff@gmail.com> wrote:
> > is there any library or facility in Lua for working with 2D euclidean
> > vectors?
> 
> There's a C extension module for 3D vectors, called lv3
> 
> http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/
> 
> It's specifically intended as a 'learning aid', so this could be a
> useful starting point.

To use it under 5.2, you need to remove v3.lua and change lv3.c:

     diff orig/lv3.c ./lv3.c
     18,19c18
     <  if (luaL_checkudata(L,i,MYTYPE)==NULL) luaL_typerror(L,i,MYTYPE);
     <  return lua_touserdata(L,i);
     ---
     >  return luaL_checkudata(L,i,MYTYPE);
     76c75
     < static const luaL_reg R[] =
     ---
     > static const luaL_Reg R[] =
     87c86
     <  luaL_openlib(L,NULL,R,0);
     ---
     >  luaL_setfuncs(L,R,0);