How to print all characters in string?

Say this is my string: `“TestString”’
How would I print an output like this?

T
e
s
t
S
t
r
i
n
g

Like this:

local word = "Pizza"
for w in string.gmatch(word, "(%w)") do -- 'w' represents the individual letter returned
       print(w)
end
1 Like
local text = "TestString"
for LetterNumber, Letter in pairs (string.split(text, "")) do
	print(LetterNumber, " -> ", Letter)
end


local text = "TestString"
for i = 1, string.len(text) do
	print(i, " -> ", text:sub(i,i))
end
2 Likes