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

How do I have multiple Values in one Table Name?

Asked by 9 years ago

Permissions Module Script

1local Module = {
2    ["CanUse"] = {"TheTravelingHermit","NeutronStarStudios"}
3}
4return Module

I want to have multiple names in one Value.

1for i,p in pairs(VoiceTable) do
2 
3if speaker.Name == p then
4        Voice Commands Here
5end
6 
7end

This doesn't work, I have the basics down, I just don't know how to have multiple names in the same Table Value. Please help!

1 answer

Log in to vote
0
Answered by 9 years ago

Assuming that VoiceTable is Module.CanUse, that should be fine.

A better alternative is to use a dictionary

1local Module = {
2    ["CanUse"] = {
3TheTravelingHermit = true;
4NeutronStarStudios = true;
5}
6}
7return Module

That way you can find out if somebody is in the CanUse table with the accessor

1PlayerCanUse = Module.CanUse[Player.Name]
Ad

Answer this question