Jump to content

in pairs ()


JeViCo

Recommended Posts

marks = { 
	{ -2028.94299, 156.78644, 28.39065 },
	{ -2023.20532, 157.21294, 28.39178 },
}
for i,v in pairs(marks) do
	local coord = v[1],v[2],v[3]
	--outputChatBox(coord)
	marker = createMarker(coord, 2,"corona",2,150,255,150,150)

end

Hello everyone! I treid to use pairs/ipairs today but markers didn't appear and i got this

screenshot_1.jpg

Any suggestions?

Edited by Juuve
Link to comment
  • Moderators
marks = { 
	{ -2028.94299, 156.78644, 28.39065 },
	{ -2023.20532, 157.21294, 28.39178 },
}

for i,v in ipairs(marks) do
	marker = createMarker(v[1], v[2], v[3], 2,"corona",2,150,255,150,150)
end

 

Edited by gpetersz
Link to comment
  • Moderators

marker = createMarker(v[1], v[2], v[3], 2,"corona",2,150,255,150,150)

 

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

 

In your code:

coord == v[1]

And v[2], v[3] are left out.

 

Which gives you this result:

marker = createMarker(v[1], 2,"corona",2,150,255,150,150)

And that isn't what you want.

 

 

 

  • Like 1
Link to comment

the main problem that i get x,y,z ouput in chat correct, but i can't use it in createMarker even with tonumber. I got same result by using createMarker(v[1]) + pairs and createMarker(v[1], v[2], v[3]) + ipairs - SAME\\\\

marks = { 
	{ -2028.94299, 156.78644, 28.39065 },
	{ -2023.20532, 157.21294, 28.39178 },
}
for i,v in pairs(marks) do
	local coord = v[1],v[2],v[3]
	outputChatBox(v[1]..", "..v[2]..", "..v[3])
	marker = createMarker(coord, 2,"corona",2,150,255,150,150)

end

Output with this code + same error: screenshot_2.jpg

Edited by Juuve
Link to comment
  • Moderators

Your syntax was bad.

marks = { 
	{ -2028.94299, 156.78644, 28.39065 },
	{ -2023.20532, 157.21294, 28.39178 },
}

for i,v in ipairs(marks) do
    marker = createMarker(v[1], v[2], v[3], "checkpoint", 2, 150, 255, 150, 150)
end

 

  • Thanks 1
Link to comment
2 minutes ago, gpetersz said:

Your syntax was bad.


marks = { 
	{ -2028.94299, 156.78644, 28.39065 },
	{ -2023.20532, 157.21294, 28.39178 },
}

for i,v in ipairs(marks) do
    marker = createMarker(v[1], v[2], v[3], "checkpoint", 2, 150, 255, 150, 150)
end

 

Thank you so much! That works now. I wrote the size before type//

Edited by Juuve
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...