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

How to check boolean in table with a corresponding name?

Asked by 3 years ago

Hi. I'm making a keycard system and I need to know how to read a table that works something like this

local cards = {
    ["a"] = true,
    ["b"] = true,
    ["c"] = true,
    ["d"] = false,
    ["e"] = true,
    ["f"] = false
}

and return if it's true or false, and call it for any of the keycards. I really can't get my finger on how to do this, and any help would be appreciated! Thanks!

1 answer

Log in to vote
0
Answered by 3 years ago

Figured it out myself.

for i, v in ipairs(cards) do
    if v[plr.Name] == true then
        print("e")
    end
end
Ad

Answer this question