Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function chunk(str,parts)
- local len=math.floor(#str/parts)
- local res={}
- for i=0,parts-1 do
- table.insert(res,string.sub(str,len*i,(len*(i+1))-1))
- end
- if len*parts~=#str then
- res[#res]=string.sub(str,(len*(parts-1)))
- end
- return res
- end
Advertisement
Add Comment
Please, Sign In to add comment