Why use a do-end block in Lua?
Posted
by
Mayron
on Stack Overflow
See other posts from Stack Overflow
or by Mayron
Published on 2014-05-27T17:22:01Z
Indexed on
2014/05/27
21:27 UTC
Read the original article
Hit count: 210
I keep trying to find answers for this but fail to do so. I wanted to know, what is the do-end block actually used for? It just says values are used when needed in my book so how could I use this?
Do I use it to reduce the scope of local variables by placing a function in a do-end loop and place local variables outside of the function but inside this do-end block and the variables will be seen by the function? But then can the function still be called?
Sorry for being very vague. I hope that makes sense. Maybe an illustrated example might be useful ^^
© Stack Overflow or respective owner