Kazafka Posted May 13, 2020 Share Posted May 13, 2020 (edited) After many tries, I got actually half of my question answered, but still how to do from this: 1001, 1086, 1025 To this: { 1001, 1086, 1025 } Any ideas? Edited May 13, 2020 by VaporZ Link to comment
Geo Posted May 13, 2020 Share Posted May 13, 2020 Are any of these values assigned to a variable? t = {1001, 1086, 1025} or if they're: t = {a,b,c} Link to comment
Kazafka Posted May 13, 2020 Author Share Posted May 13, 2020 (edited) 4 hours ago, Geo said: Are any of these values assigned to a variable? t = {1001, 1086, 1025} or if they're: t = {a,b,c} Well, i converted this table: {1015, 1008, 1087, 1086, 1084} To this string using table.concat(): "1015, 1008, 1087, 1086, 1084" Now, how can I un-concat this string, to make it table again?? Any ideas? CLOSE THIS TOPIC, I HAVE AN ANSWER!!! Edited May 13, 2020 by Patrick Link to comment
Geo Posted May 13, 2020 Share Posted May 13, 2020 (edited) 4 hours ago, VaporZ said: Well, i converted this table: {1015, 1008, 1087, 1086, 1084} To this string using table.concat(): "1015, 1008, 1087, 1086, 1084" Now, how can I un-concat this string, to make it table again?? Any ideas? CLOSE THIS TOPIC, I HAVE AN ANSWER!!! Would you be able to post your answer so people that encounter your problem in the future be able to use this as reference / solution? Edited May 13, 2020 by Patrick Link to comment
Kazafka Posted May 13, 2020 Author Share Posted May 13, 2020 3 hours ago, Geo said: Would you be able to post your answer so people that encounter your problem in the future be able to use this as reference / solution? Here you go: To convert string like "element one, element two, element three" to table, you do: str = "element one, element two, element three" tab = string.split(string, ", ") To convert table like {"element one", "element two", "element three"} back, to string you do: tab = {"element one", "element two", "element three"} str = table.concat(tab, ", ") Hope I helped you too! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now