Moderators IIYAMA Posted October 18, 2012 Moderators Posted October 18, 2012 What can you do with break? Does it works the same as return? (I can't find this on wikimta) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Moderators IIYAMA Posted October 18, 2012 Author Moderators Posted October 18, 2012 I don't get what you mean: "for for and while" Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Anderl Posted October 18, 2012 Posted October 18, 2012 break stops for loops, while statements and I guess it stops repeat too. It's a common "variable" in almost all languages. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
50p Posted October 18, 2012 Posted October 18, 2012 return stops the function and returns a value or multiple values, break, breaks the loop but doesn't stop a function function aFunc( stopAt ) local a; for i = 1, 10 do if i == stopAt then a = i; break; -- stops the loop but keeps executing rest of the function end end -- break hits end of the loop -- do something else here return a; end - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
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