superior
|
  |
| Joined: 13 Apr 2008 |
| Total Posts: 1662 |
|
|
| 03 Sep 2011 09:30 PM |
list = workspace:children() node = {} function loadMap() for i = 1, #list do wall = list[i] if wall:IsA("BasePart") and wall.Name == ("Block") then table.insert(node, wall.Position) end end end
loadMap() print(node[i]) It's printing "nil"... I can't find a reason why?
|
|
|
| Report Abuse |
|
|
|
| 03 Sep 2011 09:45 PM |
| Position is a Vector3 value, not a string :P |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 03 Sep 2011 09:50 PM |
@Dr
print automatically calls tostring()
...
i is undefined, which is why it prints nil. Try print(node[1]) |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2011 09:52 PM |
@sw I know, however can it automatically tostring() 3 number values? |
|
|
| Report Abuse |
|
|
GoldenUrg
|
  |
| Joined: 23 Aug 2009 |
| Total Posts: 6428 |
|
|
| 03 Sep 2011 09:55 PM |
It doesn't need to be a string to print but
i is not defined outside the for loop. |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 03 Sep 2011 09:55 PM |
Yes.
IIRC it prints them out in order.
print(Vector3.new(1, 2, 3)) >1 2 3 |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2011 09:55 PM |
UMG GoldenUrg Where have you old SHers gone to? |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 03 Sep 2011 09:56 PM |
Mostly Scripters.
2 Floodchecks. |
|
|
| Report Abuse |
|
|
superior
|
  |
| Joined: 13 Apr 2008 |
| Total Posts: 1662 |
|
|
| 03 Sep 2011 09:56 PM |
| But when I put it in the loop, the same thing happens. It's clearly defined if I put it in the loop. Please correct me if I'm wrong. |
|
|
| Report Abuse |
|
|
swmaniac
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 03 Sep 2011 09:57 PM |
| List won't necessarily be the same length as node, so some indexes that are valid in list will be nil in node. |
|
|
| Report Abuse |
|
|