An example:
Code: Select all
Function Recursive(n, round)
if Round>20 then return
If hasItem(TempTable, n) then return
TempTable[n] = true
Recursive(n+1, round+1)
Recursive(n*10, round+1)
endfunction
Local TempTable = {}
Recursive(1)
But point being that in this case I am using TempTable to check that same number is not being checked twice.
Making TempTable Global, will definetily work, but since this Table has no other use, but this temporary use here, then could I safely use Local here, since basically only reference to this Local table is being sent to Recursive function, so from that point of view it is safe, but is there a risk it would stop existing in middle of doing recursive functions, or a risk that some other table inside the recursive function would occupy its memory space?