DarkLink Posted July 24, 2011 Posted July 24, 2011 Guys is there a way to stop looping a table? I mean the table have 10 elements, but I just want to loop the table for the first five, the other five wont get loaded, just ignored. Appreciate some help guys. Thanks.
DarkLink Posted July 24, 2011 Author Posted July 24, 2011 thanks for ur reply, but look this: for i,k in ipairs (getElementsByType("vehicle")) do -- how do I do what is here only for the first five cars, when reach the six exit for or do nothing.. end Thanks buffalo.
JR10 Posted July 24, 2011 Posted July 24, 2011 for i,k in ipairs (getElementsByType("vehicle")) do if i == 5 then break end end
DarkLink Posted July 24, 2011 Author Posted July 24, 2011 for i,k in ipairs (getElementsByType("vehicle")) do if i == 5 then break end end Hmm I see so break is used to leave the for that is inside, right? Thanks.
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