lua-users home
lua-l archive

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


> > I guess the next code gives a reasonable solution for 2D arrays.
> >  (It should not be too dificult to generalize it to n dimensions.)
> >
> >  [...]
> 
> Every time m[i][j] is called two new closures are created to be used
> only once. Would it drive GC crazy if m[i][j] is used withing loops
> millions of times??

Maybe there is something wrong in my code, but I think it memorizes
accesses to m[i]. So, the first time m[i] is accessed Lua creates two new
closures (plus one table), but after that, the following accesses do not
create anything (until the next collection).

-- Roberto