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

How do I check multiple variables at once?

Asked by 3 years ago
Edited 3 years ago

So I have a table. My goal is to get the variables inside the table and compare them to something such as a players name. How would I do this multiple times? As the variables are named the same thing.

all i've really got is this but it will only check the first name in the table and not the second, sorry if this is confusing. I've tried to explain as best I can.

local table = {name = coolname, name = othercoolname}

if table.name == something then



end

1 answer

Log in to vote
0
Answered by
emervise 123
3 years ago
local nameWhitelist = {coolname, othercoolname}

for i,v in pairs[nameWhitelist]
    if v == something then
    --code 
0
Sorry if this didn't answer your question. I wasn't exactly sure what you meant. The easiest way to check multiple variables at once would be to use a for loop. emervise 123 — 3y
Ad

Answer this question