Hello,
I am wondering how I can separate stringValues?
If I have a stringValue that has: "100 | Title | Views" All separated with a | is there a way I can make an array separating each of the bits of text between the "|"?
And also, how do I access different parts of an array?
Thanks, Ethan!
try looking at these pages
https://www.lua.org/pil/20.2.html
http://lua-users.org/wiki/PatternsTutorial
http://wiki.roblox.com/index.php/String_pattern
code:
local raw = "100 | Title | Views" local data = {} for word in string.gmatch(raw, '([^ | ]+)') do -- looks for a pattern in the string table.insert(data, word) --add the separated version to data end --we can see if this worked by unpacking it print(unpack(data))
output: 100 Title Views