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

How would I select one item in a table?

Asked by
Silicti 40
7 years ago
Edited 7 years ago

So lets say I have this;

playerParam = {
['Username'] = plr.Name,

['Id'] = plr.PlayerId
}

( Ignore the fact I haven't defined plr)

How would I be able to select one of these items in a table?

1 answer

Log in to vote
0
Answered by
Link150 1355 Badge of Merit Moderation Voter
7 years ago
Edited 7 years ago

There are two ways.

playerParam.Username or playerParam["Username"]

This is called indexing.

For more info on indexing and tables in general, please see this question.

0
Thanks! So it's similar to the concept of ModuleScripts? Silicti 40 — 7y
0
Module scripts usually return a table of functions, so yes. Link150 1355 — 7y
Ad

Answer this question