lua-users home
lua-l archive

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

Hi Hakki,
I've been using you Cairo bindings for Lua.  Thanks very much for
this.  It's working like a charm and your code is very clean.  One
question I have is why you decided to represent the Cairo C structs as
tables instead of using userdata.  An example:

static void push_matrix(lua_State* L, cairo_matrix_t *matrix)
    set_numfield(L, "xx", matrix->xx);
    set_numfield(L, "yx", matrix->yx);
    set_numfield(L, "xy", matrix->xy);
    set_numfield(L, "yy", matrix->yy);
    set_numfield(L, "x0", matrix->x0);
    set_numfield(L, "y0", matrix->y0);

When you get into for loops where you're using alot of the data
structures represented this way, it adds quite an overhead.  I wonder
if you would consider moving these kinds of things to a userdata
representation for a future release?