lua-users home
lua-l archive

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


hi

i'm writing some code that at the moment does a lot of dynamic table creation, ie local bob = {}.

in order to get around this i thought of writing a RunTimeTableManager object which manages a table pool, and which i can query for new tables each time i want one, ie local bob = RunTimeTableManager.NewTable(), at which point the table is removed from the RunTimeTableManager's pool.

what would be nice is for the tables to automatically return themselves to the RunTimeTableManager's pool when they were done with being used. can i do this with the garbage collector? if each table i return from RunTimeTableManager.NewTable() has a __gc method which pushes the table back into the RunTimeTableManager's pool, will this cause things to explode in ugly ways?

cheers
d
--
f r e y
live music with machines
http://www.frey.co.nz