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 7 years ago

For example:

01local module = {}
02Dev = "Dev"
03Devid = {3889301,12891821029,18209309120293,0192093}
04function module.Plan(argument)
05    if argument == Dev then
06        if game.CreatorId == -- one of the IDs in Devid
07        warn("dev loaded")
08        print(game.CreatorId)
09        end
10    end
11end
12return module

Please Help me awnser this :)

1 answer

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

Answer this question