Skip to the edit as the information below is incorrect.

I need to check if a player's ID is in a dictionary table. The problem is that the ModuleScript I'm using to get the table will return it like this:

local table = {
    ['name'] = "123456789"
}

Because of this, I can't really use something like if table[player.UserId] then, where a key would be like ['123456789'] = true. Is there a different way I could do this that would be compatible with this? I do not need the key to have a specific name. Thank you!

BIG EDIT: Apparently, the ModuleScript actually returns an array like this:

[{name="cardName",desc="cardDescription",...},{name="cardName",desc="cardDescription",...}]

This completely changes my question, sorry for the confusion.

10 comments

0

what are the names of the keys in the table?

0

the names of the key would always be 'name', but I just used 'id' as an example because the key name doesn't matter. now that I think about it, it might actually since the key name is always the same thing.

0

editing now to have the key name as "name"..

0

i'm still confused because you can't have multiple keys with the same name. what is name? the player's name?

0

the API is going to return a new table every time, so the keys won't be in the same table. the key's name is always "name", the value is going to be the player's id. I can't change how the API works, so I'm stuck with this.

0

for reference, the API will give the JSON under the "Response" section at the link https://getenveloped.com/trelloapi/detail.php?resource=GetCardsInList but it will be decoded to a table with JSONDecode.

0

im helping someone else ill help u in a bit

0

okay, also apparently it actually returns an array like [{name="cardName",desc="cardDescription",...},{name="cardName",desc="cardDescription",...}] which changes my question quite a bit

0

so what's the question now?

0

almost the same thing, I want to search if a key in the array with the name "name" matches the user's ID.