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: what are semicolons for in Lua?

Previous Thread :: Next Thread 
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
05 Oct 2015 09:17 PM
I see people use them a lot in lua and I'm not sure why?


I used to be a scripter like you, until I took an arrow to the knee
Report Abuse
SoapyDishy is not online. SoapyDishy
Joined: 31 Aug 2015
Total Posts: 2169
05 Oct 2015 09:18 PM
compared to other languages, I think roblox Lua is terrible.
Report Abuse
Fazana is not online. Fazana
Joined: 21 Feb 2009
Total Posts: 28722
05 Oct 2015 09:19 PM
Semicolons in coding is used for an end line.

However, in most cases, Lua does that itself.

Of course, there's a few exceptions where it will need semis to specify where it ends.

~I hope your day sucks.~ R$15,388, ~Tx3,959
Report Abuse
Rocketerkid is not online. Rocketerkid
Joined: 10 Oct 2011
Total Posts: 1237
05 Oct 2015 09:24 PM
I don't think I've ever actually found a huge use fro them in Lua, other than in tables. I know you use them in a lot of other languages, though. I think people on Roblox mainly use them to keep it concise. More organized, sort of.
Report Abuse
Fazana is not online. Fazana
Joined: 21 Feb 2009
Total Posts: 28722
05 Oct 2015 09:24 PM
Yeah, tables and arrays are literally the only use I have for semicolons.

~I hope your day sucks.~ R$15,388, ~Tx3,959
Report Abuse
DermonDarble is not online. DermonDarble
Joined: 04 Jun 2015
Total Posts: 2576
05 Oct 2015 09:26 PM
You won't ever need to use semicolons in Lua.

inserting inclusive nodes
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
05 Oct 2015 09:58 PM
'compared to other languages, I think roblox Lua is terrible.'
Typical idiot who has no idea what Lua is and how it works.
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
05 Oct 2015 10:17 PM
To end a statement. You can use them like you would in languages that require semicolons such as Java/C++, but you don't have to -- they're optional. Though most people who've never programmed before wouldn't dare use them, if you're a C programmer who's just learning Lua, you might prefer them.

I prefer to use them in place of commas on multi-lined tables because commas look weird at the end of the line.
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
05 Oct 2015 10:19 PM
^right?!
Report Abuse
Blues714 is not online. Blues714
Joined: 23 Dec 2008
Total Posts: 6507
05 Oct 2015 10:44 PM
lua doesn't really require the use of semicolons

but you could use it
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
05 Oct 2015 11:32 PM
all I know is that you use them in arrays

local array = {
potato = hi;
apple = hi;
tomato = hi;
carrot = 2short4u;
}

ʏᴏᴜ ᴛʜᴏᴜɢʜᴛ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴅʀᴀɢ ᴍᴇ ᴛᴏ ᴛʜᴇ ʙᴏᴛᴛᴏᴍ ᴏғ ᴛʜᴇ ʟᴀᴋᴇ sᴏ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴇᴀᴛ ᴍᴇ ʟᴀᴛᴇʀ... ᴡᴇʟʟ ɢᴜᴇss ᴡʜᴀᴛ ᴘᴜɴᴋ... ɪᴍ ᴀ ғɪsʜ... ᴡɪᴛʜ ʟᴇɢs
Report Abuse
devHoodie is not online. devHoodie
Joined: 04 Nov 2008
Total Posts: 30332
05 Oct 2015 11:39 PM
To make LUA seem fancy.
(inb4Blarrius)
-- Former AKA : luis15232
Report Abuse
Blarrius is not online. Blarrius
Joined: 17 Aug 2015
Total Posts: 2
05 Oct 2015 11:39 PM
I think that when lua is compiled, it compiles into c or c++. So semicolons are complied into it. It might make compiling process faster. I can't say for sure.
In arrays it is necessary to separate them from other placements in the array.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
05 Oct 2015 11:41 PM
'To make LUA seem fancy.'
no.

'I think that when lua is compiled, it compiles into c or c++. So semicolons are complied into it. It might make compiling process faster. I can't say for sure.
In arrays it is necessary to separate them from other placements in the array.'
No and no (and no).
Lua is compiled into lua bytecode, the semi-colons are completely optional and will not make compilation neither faster nor slower. Also you can use commas to separate pairs in a table, you don't NEED a semicolon.
Report Abuse
Froast is not online. Froast
Joined: 12 Mar 2009
Total Posts: 3134
06 Oct 2015 06:55 AM
There are a few rare situations where a semicolon would be required in order to prevent ambiguity.
Consider the following:

print('Hi')
(print or echo)('Bye')

The compiler could see this two ways:

print('Hi')(print or echo)('Bye');

calling the return of print with the arguments

OR

print('Hi');
(print or echo)('Bye')

using either print or echo with 'Bye' on the next line

If you intended the second, you must put a semicolon. No matter how much whitespace you put the compiler will always reject it because it won't know what you intended to do.

Other than those situations, however, there isn't any need for them.
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
06 Oct 2015 07:08 AM
it can be used lik this:


test = {
val = "Hello"
printHello = function(this)
print(this.val)
end
}

test:printHello()
-- prints 'Hello'
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
06 Oct 2015 07:09 AM
lol read wrong XD
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
06 Oct 2015 08:31 AM
gee, you didn't even use a semi
how can you possibly read that wrong

-=Robo=-
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
06 Oct 2015 09:10 AM
ik I though I read colon, but when I posted I readed semicolon, well well if someone here didn't know that about colon then they learnt something.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
06 Oct 2015 10:33 AM
semicolons are used for:

1. Marking the end of a statement (Unnecessary)
2. Separating values in a table (Can be done with comma instead)
3. Avoiding ambiguous syntax errors (Rarely happens, if you're a clean coder)
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
06 Oct 2015 10:53 AM
I would still use semi-colons, so, if you ever want to expand to other languages which require it, it will become second-nature.

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
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