Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

bad argument #1 to 'concat' (table expected, got string)?

Asked by
pwx 1581 Moderation Voter
6 years ago

Hello. I've recently run into this error whilst scripting? Can someone tell me why?

It works all the way up to the point of the print(table.concat) part.

Getting this error: bad argument #1 to 'concat' (table expected, got string)

Managers = { 
'zonit',
'EIijahMikaelson',
}

local function getValues(tableName)

print(table.concat(tableName, ", "))

end



Player.Chatted:Connect(function(Message)
Message = Message:lower()
if string.sub(Message,1,10) == '.getvalues' and isReady == true and isIntro == false and isManager() then
local tableName = string.sub(Message,11)
getValues(tableName)
    end
end)


1
Forgot the add, the script itself is suppose to get all the values of the 'Managers' table and print it. pwx 1581 — 6y
0
TableName is a string. SirDerpyHerp 262 — 6y
0
uhhh TheluaBanana 946 — 6y
0
wait u went through all of this to print the managers table? TheluaBanana 946 — 6y
View all comments (3 more)
0
There is code under it, but of course I need to make sure the print worked first. pwx 1581 — 6y
0
How would I change the string into a way it counts as the table instead of the string? pwx 1581 — 6y
0
maybe make it a table {tableName} on line 18 User#24403 69 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

if i catched ur question, this should work

local managers = {"zonit", "EIijahMikaelson"}

for i, v in pairs(managers) do
    print(v)
end
0
the thing is, I don't need it to print. I want to put the values on a text label all in a row, so I tried to use concat to do so. pwx 1581 — 6y
0
I'ts okay, found a way. Thanks anyway! pwx 1581 — 6y
0
lol TheluaBanana 946 — 6y
Ad

Answer this question