If I understand what you are saying, try this for cleaning the table. Create a dummy variable with a new blank table and set your global variable to that blank table.
Code:
local blanktable = {};
setglobal("fred",blanktable);
I am just thinking this up, so I really have not tried it nor can immediately comfirm if it will run.