Jump to content

getting var from for loop


BulleTTime

Recommended Posts

Hi, could anyone explain why the "id" var cant be accesed right after the for loop. It always get me an error:

"Bad argument @ 'outputChatBox'"

when i trace the id inside the for loop it does work..

  
for num = 1,amount do 
    if (getDistanceBetweenPoints3D(cords[num].x, cords[num].y, cords[num].z, x, y, z) < getDistanceBetweenPoints3D(cords[num-1].x, cords[num-1].y, cords[num-1].z, x, y, z)) then 
        local id = cords[num].Id 
    end  
end 
outputChatBox(id, source) 
  

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...