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

How do I check if a value is in a table?

Asked by 6 years ago

For example:

local module = {}
Dev = "Dev"
Devid = {3889301,12891821029,18209309120293,0192093}
function module.Plan(argument)
    if argument == Dev then
        if game.CreatorId == -- one of the IDs in Devid
        warn("dev loaded")
        print(game.CreatorId)
        end
    end
end
return module

Please Help me awnser this :)

1 answer

Log in to vote
0
Answered by 6 years ago
local module = {}
local devtable = {3889301,12891821029,18209309120293,0192093}
function check(num)
for _,v in pairs(devtable) do
if v == num then
return true
end;end;end
function module.Plan(arg)
if arg == "Dev" and check(game.CreatorId) == true then
warn("dev loaded.")
warn(game.CreatorId)
end;end
return module
0
Thanks UltraaaDev 85 — 6y
0
np nowayhahaha 18 — 6y
0
How would I also make it check if there is a diffrent Arg And If it is in a diffrent table? UltraaaDev 85 — 6y
Ad

Answer this question