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
 

Re: When do you put semicolons in tables?

Previous Thread :: Next Thread 
eviljulian is not online. eviljulian
Joined: 27 Apr 2010
Total Posts: 1904
27 Aug 2011 01:05 PM
Instead of commas, when do semicolons replace commas?
Report Abuse
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
27 Aug 2011 01:08 PM
semicolons aren't needed in ROBLOX.
Report Abuse
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
27 Aug 2011 01:09 PM
the semicolon (;) is used to indicate the end of a statement. It is optional.
Report Abuse
eviljulian is not online. eviljulian
Joined: 27 Apr 2010
Total Posts: 1904
27 Aug 2011 01:11 PM
They are needed...

I've seen scripts with semicolons.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
27 Aug 2011 01:13 PM
Only in certain specific situations are semicolons ever needed.
Report Abuse
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
27 Aug 2011 01:13 PM
You may have seen them with semicolons, as they are tolerated. But they are not needed to run the code.
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
27 Aug 2011 01:13 PM
They aren't needed.


I didn't latepost, someone just earlyposted:.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
27 Aug 2011 01:15 PM
They're needed in C++

// Signature code start
Blocco::StartSignature();
Blocco::AppendToSignature("OHaider");
Blocco::EndSignature();
Blocco::FlushSignature();
// Signature code end
Report Abuse
eviljulian is not online. eviljulian
Joined: 27 Apr 2010
Total Posts: 1904
27 Aug 2011 01:16 PM
Well semicolons look cool :3
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
27 Aug 2011 01:19 PM
I meant in Lua :c of course you need them in C++ after each argument.


I didn't latepost, someone just earlyposted:.
Report Abuse
eviljulian is not online. eviljulian
Joined: 27 Apr 2010
Total Posts: 1904
27 Aug 2011 01:33 PM
They ARE needed in Vector3 color for GUIs.

(255; 255; 255)
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
27 Aug 2011 01:35 PM
No they aren't you use commas Color3.new(1, 1, 1)


I didn't latepost, someone just earlyposted:.
Report Abuse
eviljulian is not online. eviljulian
Joined: 27 Apr 2010
Total Posts: 1904
27 Aug 2011 01:37 PM
Vector3? Ignore that... 0.e
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
27 Aug 2011 01:40 PM
Here is one of the only situations when semicolons are required.

(function() end)()
(function() end)()

--error


(function() end)();
(function() end)()

--No error
Report Abuse
Ozzypig is not online. Ozzypig
Joined: 27 Mar 2008
Total Posts: 4906
27 Aug 2011 01:53 PM
Semicolons can be used INSTEAD of commas in tables. This is valid:

a = {1;2;3}
b = {hello="world";herp="derp"}

Semicolons are optional* in ending normal Lua statements:

a = 5;
print(a); -->5

However, as stated above there are some exceptions:

(function ()
print("This is an anonymous function")
end)()
(function ()
print("This is another anonymous function")
end)()

The above causes an error.

(function ()
print("This is an anonymous function")
end)(); --a semicolon here ends this statement and calls the anon. function
(function ()
print("This is another anonymous function")
end)()
Report Abuse
pwnedu46 is not online. pwnedu46
Joined: 23 May 2009
Total Posts: 7534
27 Aug 2011 02:15 PM
They're not required in lua, but some people prefer to use them. This is usually how I've seen them used.


mahTable{
"blah" = 1234;
"cake" = 1337;
}

print(mahTable.blah)
> 1234


______________________________________
~pwnedu46~
-I lost the game.-
I love making dooly-bops. ~ArceusInator
Report Abuse
eviljulian is not online. eviljulian
Joined: 27 Apr 2010
Total Posts: 1904
27 Aug 2011 02:21 PM
I understand now. Thanks.
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