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: Somethings wrong. Help please. :3

Previous Thread :: Next Thread 
superior is not online. 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
DrSprinkles is not online. DrSprinkles
Joined: 27 Aug 2011
Total Posts: 457
03 Sep 2011 09:45 PM
Position is a Vector3 value, not a string :P
Report Abuse
swmaniac is not online. 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
DrSprinkles is not online. DrSprinkles
Joined: 27 Aug 2011
Total Posts: 457
03 Sep 2011 09:52 PM
@sw
I know, however can it automatically tostring() 3 number values?
Report Abuse
GoldenUrg is not online. 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 is not online. 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
DrSprinkles is not online. DrSprinkles
Joined: 27 Aug 2011
Total Posts: 457
03 Sep 2011 09:55 PM
UMG GoldenUrg
Where have you old SHers gone to?
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
03 Sep 2011 09:56 PM
Mostly Scripters.

2 Floodchecks.
Report Abuse
superior is not online. 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 is not online. 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
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