Table.concat() suddendly doesn't work

So ~6 hours ago, before the update, table.concat() worked fine but now it errors because the table contains instances.

Here’s the problematic line:

print(string.format("%s has %s as dependencies", tostring(currentButton.Name), table.concat(currentButton.DependOn:GetChildren(), ", ")))

And here’s the error:


(it says that it’s on line 75 and also 64 but that’s because I use a coroutine)

I tried searching a function to convert every value in a table to a string but without success.

Any help is appreciated!

thats because the contents of the :GetChildren() is a bunch of Instance’s

2 Likes

Yes I know, said it in the original post, but it used to work a few hours back.
My question is that is there any way to transform all the instances into strings, even with :GetChildren?

a lazy solution is that you could do a for loop and insert the name of each instance to a table

Thank you, I’m going to try it. But are there any other more efficient solutions, especially just for a print() statement?

1 Like

you can concatenate the name onto a string variable instead:

local joined = ''
for _, v in instances do
   joined ..= v.Name
end
1 Like

oh for that you can use table.foreach(print) (would just print it individually instead of one string if that whats you want)

1 Like

isnt foreach deprecated though?

(to add to the conversation: what i’d do is something like:

print((function() local s = "" for i, v in pairs(currentButton.DependOn:GetChildren()) do s = s..v..", " end return s)())

i dont think so, its still visible on the table documentation with show deprecateds off

1 Like

But it doesn’t work anymore, it just returns nil now.
(And Studio underlines it in yellow and says that it is deprecated)

based on this post im pretty sure it is deprecated

1 Like

oh, that’s weird, sorry for the confusion

which one doesn’t work?

This text will be blurred

table.foreach() doesn’t work, if that’s what you were asking for

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.