lua-users home
lua-l archive

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


I don't believe this solves the issue I'm running into, using your vector as the example how would i go about adding a Lenght() function?

Ive experimented with this, however this doesn't seem to work likely since it's added to the metatable.
If I expand the __index to a table with a Length() function I'll break the Lget functionality.

static const luaL_reg R[] =
{
    { "Length",    LLength        },
    { "__index",    Lget        },
    { "__newindex",    Lset        },
    { "__tostring",    Ltostring    },
    { NULL,        NULL        }
};

-Chris

On Thu, Oct 22, 2009 at 5:01 PM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> I must be making this harder then it is but I'm not sure how to lay it out.

See my lv3: http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.0/lv3.tar.gz

(Don't be mislead by the URL; the code works in Lua 5.1, though you may
need to edit the Makefile.)