Hi Troy,
Will this string always (or usually) be in this predictable format of simply numbers? If so, I suggest using “string.match()” and “string.gmatch()” and setting up the proper pattern iterator. Actually, you could do it even if the string “table items” were non-numeric, but you’d have to include other character types in the string matching iterator as well.
https://docs.coronalabs.com/api/library/string/match.html
https://docs.coronalabs.com/api/library/string/gmatch.html
This kind of thing would do the trick:
[lua]
local myString = “list={1,3,5,7}”
local tableName, tablePortion = string.match( myString, “(%w+)={([%w%d%p]-)}” )
print( tableName, tablePortion )
local myTable = {}
for tableValue in string.gmatch( tablePortion, “([%w%d%.]+)” ) do
print( tableValue )
myTable[#myTable+1] = tableValue
end
[/lua]
Brent