1 2--add the explode function 3 function explode ( seperator, str ) 4 local pos, arr = 0, {} 5 if (seperator ~= nil and str ~= nil) then 6 for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found 7 table.insert( arr, string.sub( str, pos, st-1 ) ) -- attach chars left of current divider 8 pos = sp + 1 -- jump past current divider 9 end 10 table.insert( arr, string.sub( str, pos ) ) -- attach chars right of last divider 11 end 12 return arr 13 end