--[[ mem.lua by blastbeat - provides some memory managment ]]-- ----------------------------------// DECLARATION //-- local clean = use "cleantable" --// lua functions //-- local next = use "next" local pairs = use "pairs" --// functions //-- local gettable local addtable --// tables //-- local _tables ----------------------------------// DEFINITION //-- _tables = { } gettable = function( ) local tbl = next( _tables ) if tbl then _tables[ tbl ] = nil clean( tbl ) return tbl end return { } end addtable = function( tbl ) _tables[ tbl ] = true end ----------------------------------// BEGIN //-- use "setmetatable" ( _tables, { __mode = "k" } ) ----------------------------------// PUBLIC INTERFACE //-- return { gettable = gettable, addtable = addtable, }