doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 21 Dec 2012 11:29 AM |
I'm looking at tables on the wiki and I can't figure out something.
local myDictionary = { ["Roblox"] = "A massively multiplayer online game", ["Wiki"] = "A Web site developed collaboratively by a community of users", ["Lua"] = "A lightweight multi-paradigm programming language" }
Why not just say
Roblox = "A massively multiplayer online game"
and what is the purpose of them saying myDictionary = { ?
is this so that they can say print(myDictionary) and then it prints all of that data? I feel very confused. |
|
|
| Report Abuse |
|
|
Dex1337
|
  |
| Joined: 01 Aug 2012 |
| Total Posts: 185 |
|
|
| 21 Dec 2012 11:31 AM |
You use it in a form of
for i, v pairs do(myDictionary)
and you add the rest, its supposed to hold info instead of typing it all out. Easier |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2012 11:33 AM |
| It creates a table of data. Dex1337 is right about how to print it, though. |
|
|
| Report Abuse |
|
|
doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 21 Dec 2012 11:38 AM |
| So to put it into context, what is a way I could use it in a game? |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2012 11:40 AM |
if you want it to give a message, use an array.
x = Instance.new("Hint", workspace) x.Text = "" texts = {"Hi", "Welcome", "Be nice"}
while wait() do for i = 1,#texts do x.Text = texts[i] wait(2.5) end end |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2012 11:41 AM |
In my case, I use it for labeling data in a table
For example
local maps = { [1] = game.Lighting.Map1; [2] = game.Lighting.Map2; [3] = game.Lighting.Map3 } |
|
|
| Report Abuse |
|
|
doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 21 Dec 2012 11:58 AM |
| Oh okay. So it simplifies your script. You could get around not doing it if you wanted to, but for more complex things, this would be an easy way to go. Thanks |
|
|
| Report Abuse |
|
|