# Concated table to table

## Recommended Posts

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 by VaporZ

Are any of these values assigned to a variable?

`t = {1001, 1086, 1025}`

or if they're:

`t = {a,b,c}`

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
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
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!

## Create an account

Register a new account