generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Tables

Previous Thread :: Next Thread 
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
16 Aug 2012 01:04 AM
Would this print "c1" ?

TableA = {TableB = {"b1","b2"}, TableC = {"c1","c2"}}
print(TableA[2[1]])
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
16 Aug 2012 01:05 AM
Why not test it?
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
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
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
16 Aug 2012 01:11 AM
Tried it in the Lua Live Demo. Doesnt work D:
Report Abuse
miz656 is not online. 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 is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
16 Aug 2012 01:14 AM
"print(TableA[2[1]])"

print(TableA[2][1])
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
16 Aug 2012 01:17 AM
@MrNicNac Workspace.Tables:2:attempt to index field "?" (a nil value)
Report Abuse
MrNicNac is not online. 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
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
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 is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
16 Aug 2012 01:38 AM
They could, yes.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image