Guest User

Untitled

a guest
May 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. local string2Chunk = "sldkfjslkfjsdflksjlksdfjsdklfjsdflksjdflksdjsdkfljskldf"
  2. -- could be from input
  3.  
  4.  
  5. local function chunkString2Table(sString, iChunkLen)
  6. local retTable = {}
  7. local firstChunk
  8. while string.len(sString)>=iChunkLen do
  9. firstChunk = string.sub(sString, 1, iChunkLen)
  10. table.insert(retTable, firstChunk)
  11. sString = string.sub(sString, iChunkLen)
  12. end
  13. if string.len(sString)>=1 then
  14. table.insert(retTable, sString)
  15. end
  16.  
  17. return retTable
  18. end
  19. local chunkTable = chunkString2Table(string2Chunk, 10)
  20.  
  21. print (table.concat(chunkTable))
Add Comment
Please, Sign In to add comment