Jump to content

Concated table to table


Kazafka

Recommended Posts

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 by Patrick
Link to comment
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 by Patrick
Link to comment
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...