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 » Scripting Helpers
Home Search
 

Use of Semicolons

Previous Thread :: Next Thread 
Cr0ws is not online. Cr0ws
Joined: 16 Aug 2013
Total Posts: 1545
12 May 2014 07:00 PM
I see them at the ends of stuff like

cam.CameraSubject = "Watch";

Any direct answer of it's use?
Report Abuse
awesom914 is not online. awesom914
Joined: 06 Mar 2011
Total Posts: 4222
12 May 2014 07:01 PM
They are used in other languages but not in lua.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
12 May 2014 07:01 PM
My friend Bloxks told me it closes an equal sign. It's optional, but supposedly helps the script get to the next line quicker.
Report Abuse
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
12 May 2014 07:07 PM
I've once in my lifetime of using Lua run into an error because I didn't use a semicolon, but they're almost entirely unnecessary.


Take a look at this script!

local t1, t2 = {"a"}, {"b"};

local y = false;
local x = y;
(x and t1 or t2)[1] = "Hi";

print("t1", table.concat(t1, ", "));
print("t2", table.concat(t2, ", "));

--end of script

If y is true, then t1[1] is changed to "Hi".
If y is false, then t2[1] is changed to "Hi".

Now change this line:
local x = y;
to this:
local x = y

It will think you're trying to do a function call on y and when it reads the next equals sign, it will get way confused. It won't even compile!




A very very very very very very niche case, but sometimes it happens. :P
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
12 May 2014 07:13 PM
You can also use semicolons to separate pre-defined key-value pairs in a table (instead of a comma).
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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