BulleTTime Posted April 13, 2009 Share Posted April 13, 2009 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
Brophy Posted April 13, 2009 Share Posted April 13, 2009 Because the variable 'id' is local to the if statement in the loop, so remove the local Link to comment
BulleTTime Posted April 14, 2009 Author Share Posted April 14, 2009 im getting still the error,without the local Link to comment
Lordy Posted April 14, 2009 Share Posted April 14, 2009 Maybe the source is a nil value then Link to comment
darkdreamingdan Posted April 14, 2009 Share Posted April 14, 2009 As i said last night, outputChatBox only accepts strings, not numbers. Try using tostring() inside the outputChatBox Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now