Lua - convert string to table

lua, lua-table, string

Solution

You could use string.gsub function

t={}
str="text"
str:gsub(".",function(c) table.insert(t,c) end)

Problem

I want to convert string text to table and this text must be divided on characters. Every character must be in separate value of table, for example: - a="text" - --converting string (a) to table (b) - --show table (b) - b={'t','e','x','t'}

Original source