of     1   

4xw
#141122731Tuesday, July 22, 2014 2:09 AM GMT

i have seen people use in their scripts do --something end what does "do" do? isnt it the same as not declaring "do" in the first place?
Xephyric
#141122886Tuesday, July 22, 2014 2:11 AM GMT

while blah do for blah do Do can not be used by itself. It is used for some loops.
nomer888
#141122979Tuesday, July 22, 2014 2:12 AM GMT

"do" can be used to create enclosures for local variables that you may want to protect from the global scope. do local var = 5 function getvar() return var end end print(getvar()) -> 5 print(var) -> nil
islandmaker2012
#141123018Tuesday, July 22, 2014 2:12 AM GMT

@X although kinda pointless, do can be used by itself, as a scope
Xephyric
#141123102Tuesday, July 22, 2014 2:13 AM GMT

Oh, really! Never seen that. Learned something today xD
4xw
#141123193Tuesday, July 22, 2014 2:14 AM GMT

thank you everyone for your help
Notunknown99
#141123265Tuesday, July 22, 2014 2:14 AM GMT

Creating a scope using do can be incredibly useful in controlling variables.
Casualist
#141123665Tuesday, July 22, 2014 2:18 AM GMT

The difference is that do -- something end Creates a new scope/block. This can be useful for creating local variables that aren't stored in the main scope. An example would be using temporary values to calculate something but will never use again. Instead of having to nil these values after they are done being useful you can let the language deal with freeing up memory when the block ends. (function(...) --something end)(args) Does something similar, but you can pass arguments to your new scope/block.
128GB
#141123725Tuesday, July 22, 2014 2:19 AM GMT

Maybe not the best use but I sometimes use it to group things together, so I can click the arrow thing to collapses it to get it out of my way, I usually remove them when the script is finished though
HuntHello
#141123960Tuesday, July 22, 2014 2:21 AM GMT

@128 just don't declare local variables in it if it will be treated as a global one in "do".
128GB
#141125491Tuesday, July 22, 2014 2:38 AM GMT

@Hunt I made variables local whenever they can be I just comment out the do's before testing then take them out completely when the script is dkne
HuntHello
#141125566Tuesday, July 22, 2014 2:39 AM GMT

i see

    of     1