I think I must be misunderstanding you, because I read that as the opposite of what you just said in your original post.
"create them once globally and reuse them by wiping them with table = {} instead of recreating " vs " I highly doubt lua's implementations recognize a table created inside a loop as being the same object"
In any case, what I'm saying is there's not going to be any measurable difference between doing:
local found = {}
function find_ghosts()
found = {}
and
function find_ghosts()
local found = {}
because either way, you're just creating a new table and assigning it to a local var found
each time the function is called. There's no special functionality in lua where saying found = {}
re-uses but empties the found
table, it just creates a new table and assigns it to found
, and the previous table will be GC'd. Being local to the module vs the function makes no difference.