Code:
text = text:gsub("[\1\10\32\34\92#%%%'%(%)%*%+,%-%./%d:;<>=%[%]^{|}~]", space)
text = text:gsub("%s%a%s", space)
text = text:gsub("%s%a%s", space)
text = text:gsub("%s%s+", space)
This works, but repeats the operation twice to get rid of the cases where two single letters are separated by only one whitespace, such as..
Lua Code:
-- Original code
function someFunction(t,f) print(t,f) end
-- Step 1
function someFunction t f print t f end
-- Step 2
function someFunction f print f end
-- Step 3
function someFunction print end
-- End result
function someFunction print end