Just wondering, how could i conduct a string pattern that captures every 5 characters in a string (no matter that they are)? I know getting every character in a string is done like this:
for c in string.gmatch("hello*world*", ".") do
print(c)
end
-- h
-- e
-- l
-- l
-- o
-- *
-- w
-- ...
But how would i make it so it would split the string every 5 characters? Including all kinds, like spaces, symbols, ect. So the output from above would instead look something like this:
-- hello -- (cut at 5)
-- *worl -- (cut at next 5)
-- d* -- (cut from last 5, to end)
If someone knows how this could work, and is willing to share, I'd appreciate it very much. Thanks.

1 comment
Thank you very much.