|
| 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 |
|
|
|
| 05 Oct 2015 09:18 PM |
| compared to other languages, I think roblox Lua is terrible. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 05 Oct 2015 09:26 PM |
You won't ever need to use semicolons in Lua.
inserting inclusive nodes |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
| |
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
| |
|
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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|