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
|
  |
| 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
|
  |
| 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 |
|
|
| 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 |
|
|
| 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 |
|