generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: do end?

Previous Thread :: Next Thread 
Luckyxero is not online. Luckyxero
Joined: 26 Feb 2014
Total Posts: 505
14 Oct 2017 01:22 PM
do
print("hi")
end

Apparently that is working. Why? What is "do end"?
Report Abuse
Horrible_Pun is not online. Horrible_Pun
Joined: 13 May 2017
Total Posts: 5102
14 Oct 2017 01:29 PM
look in a dictionary for "do"
thats it
Report Abuse
helloburp is not online. helloburp
Joined: 26 Aug 2011
Total Posts: 14376
14 Oct 2017 01:29 PM
I guess "do" is just formal for following certain conditional statements but doesn't require those statements to work on it's own

lua is weird
Report Abuse
Horrible_Pun is not online. Horrible_Pun
Joined: 13 May 2017
Total Posts: 5102
14 Oct 2017 01:31 PM
thats pretty interesting actually
looks like i will use do end to stretch out my scripts lolll
Report Abuse
newdumbman2 is online. newdumbman2
Joined: 01 Apr 2010
Total Posts: 3265
14 Oct 2017 01:31 PM
stackoverflow
.
com
/
questions
/23895406/
why-use-a-do-end-block-in-lua



basically for organization and having non-colliding variables.

local x=0
do
local x=1
print(x)
end

print(x)
Report Abuse
Horrible_Pun is not online. Horrible_Pun
Joined: 13 May 2017
Total Posts: 5102
14 Oct 2017 01:33 PM
"
basically for organization and having non-colliding variables.

local x=0
do
local x=1
print(x)
end

print(x)"

wouldnt having the "do" follow the script the same way anyways?
Report Abuse
helloburp is not online. helloburp
Joined: 26 Aug 2011
Total Posts: 14376
14 Oct 2017 02:18 PM
so its like curly brackets in languages like java/c#?
Report Abuse
Ezuras is online. Ezuras
Joined: 07 Nov 2012
Total Posts: 8768
14 Oct 2017 02:35 PM
@Horrible_Pun

No.

Say I declare a variable within a function, it'll only be accessed inside of that function, and no other function within that script will be able to read that variable without declaring it again.

For example,

local Var = true -- declare a variable outside of a code block
local IsTrue = false

if Var == true then
isTrue == true
end

If you were to declare isTrue as a local variable within that block, the problem I started earlier would occur.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
14 Oct 2017 03:18 PM
"so its like curly brackets in languages like java/c#?" Yes. Those standalone curly brackets with code ###### ## ##### It's just making a new scope without the overhead of a conditional or other type of statement.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image