ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 18 May 2013 05:24 PM |
--Say I have these tables local array = {1, "string", Workspace.Part} local array2 = {2. "anotherstring", Workspace.OtherPart} --Using these for loops for i, v in pairs(array) do print(v) for i, v in pairs(array2) do print(v) end end --Would that not print the two tables? |
|
|
| Report Abuse |
|
|
dekkonot
|
  |
| Joined: 22 Dec 2010 |
| Total Posts: 6685 |
|
|
| 18 May 2013 05:25 PM |
It would not because the two loops are inside of one another and share variable names.
~ Linguam latinam est optimum ~ |
|
|
| Report Abuse |
|
|
ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 18 May 2013 05:26 PM |
*facepalm* I could just change the names, couldn't I?
Dumb question. |
|
|
| Report Abuse |
|
|
|
| 18 May 2013 05:27 PM |
--Say I have these tables local array = {1, "string", Workspace.Part} local array2 = {2. "anotherstring", Workspace.OtherPart} --Using these for loops for i, v in pairs(array) do print(v) end for i, v in pairs(array2) do print(v) end --Would that not print the two tables?
|
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 18 May 2013 05:27 PM |
Well, when you have objects in a table that aren't stringvalues, printing them would produce bytes or some other unidentifiable anomaly. You can't print a part, can you?
Now, the number and the string can be printed, but if you want the whole table to be legible, try Workspace.Part.Name instead.
Also, make sure to end each 'for' loop before starting a new one. |
|
|
| Report Abuse |
|
|
|
| 18 May 2013 05:29 PM |
Oops, I never looked at the tables. You wouldn't be able to do that.
|
|
|
| Report Abuse |
|
|
ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 18 May 2013 05:29 PM |
| I tried doing print(Workspace.Part) and it printed the name. I don't know why. |
|
|
| Report Abuse |
|
|
dekkonot
|
  |
| Joined: 22 Dec 2010 |
| Total Posts: 6685 |
|
|
| 18 May 2013 05:30 PM |
Actually, when print is called on an instance it prints the part's full name, as given by Instance::GetFullName()
~ Linguam latinam est optimum ~ |
|
|
| Report Abuse |
|
|
dekkonot
|
  |
| Joined: 22 Dec 2010 |
| Total Posts: 6685 |
|
|
| 18 May 2013 05:30 PM |
Derp. That's a different function. It prints the name...
~ Linguam latinam est optimum ~ |
|
|
| Report Abuse |
|
|
ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 18 May 2013 05:36 PM |
| From my experience, printing an instance prints its name. |
|
|
| Report Abuse |
|
|