using spaces to break up a large number

So I’ve been using the following code, which I found, to put commas in large numbers:

  
 input2 = string.gsub(input, "(%d)(%d%d%d)$", "%1,%2", 1)  
  
 while true do  
  
 input2, found = string.gsub(input2, "(%d)(%d%d%d),", "%1,%2,", 1)  
 if found == 0 then break end  
  
 end  
  

Does anyone know how to modify this so that it breaks large numbers up with spaces instead? I’m using a font that does not have commas so I don’t have the option. [import]uid: 10903 topic_id: 21885 reply_id: 321885[/import]

Try:
[lua]input2 = string.gsub(input, “(%d)(%d%d%d)$”, “%1 %2”, 1)

while true do

input2, found = string.gsub(input2, “(%d)(%d%d%d),”, "%1 %2 ", 1)
if found == 0 then break end

end[/lua] [import]uid: 10389 topic_id: 21885 reply_id: 87184[/import]