|
| 16 Aug 2012 01:04 AM |
Would this print "c1" ?
TableA = {TableB = {"b1","b2"}, TableC = {"c1","c2"}} print(TableA[2[1]])
|
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
|
| 16 Aug 2012 01:06 AM |
| Cannot do that right now. Im on vacation and Im on my phone. Just want to know :3 |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2012 01:11 AM |
| Tried it in the Lua Live Demo. Doesnt work D: |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 16 Aug 2012 01:11 AM |
| Wait till you get back. Testing brings the best results because you can actually visualize what is happening. Me telling you won't. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 16 Aug 2012 01:14 AM |
"print(TableA[2[1]])"
print(TableA[2][1]) |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2012 01:17 AM |
| @MrNicNac Workspace.Tables:2:attempt to index field "?" (a nil value) |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 16 Aug 2012 01:18 AM |
Oh yes....
TableA = {{"b1","b2"}, {"c1","c2"}} print(TableA[2][1]))
If you set the tables to variable names, you have to index them with the string names, not numbers. |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2012 01:21 AM |
Ah, There we go!
Also, could tables work like this, Im not sure of all RBX.Lua capabilities
local items = { ["no tea"] = { droppable = false, desc = "Pull yourself together man.", }, ["a pig"] = { heavy = true, creature = true, drops = { "some pork" }, aliases = { "pig" }, desc = "The pig has a square nose." } } |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
| |
|