use of the semicolon

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: use of the semicolon

Post by Azel »

Semi-colons are mandatory in languages like C++ and Java, and optional in languages like LUA and SQL.

Most of my LUA code is very much littered with semi-colons not only out of force of habit but also because I consider them to be proper identifiers for separating logical statements similar to using punctuation in standard writing and if you were to consider how even a basic communication typed in English would look that did not use a comma or period or semi-colon to separate one complete thought from another or to connect relationships and logical conditions then you would end up dealing with quite the horrible run-on sentence much like the one you are reading right this very minute

Punctuation is your friend. Omitting semi-colons from Object Oriented code is acceptable "if" (and only "if") you have mature, compact code down to a science. I have seen the Nexus LUA code and yes, that is some very well written LUA. No semi-colons are needed there at all. However, most scripting/programming hobbyists can't achieve such elegance easily, so please, use your punctuation lol :shock:
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: use of the semicolon

Post by FeMaiden »

Azel wrote:Semi-colons are mandatory in languages like C++ and Java, and optional in languages like LUA and SQL.

Most of my LUA code is very much littered with semi-colons not only out of force of habit but also because I consider them to be proper identifiers for separating logical statements similar to using punctuation in standard writing and if you were to consider how even a basic communication typed in English would look that did not use a comma or period or semi-colon to separate one complete thought from another or to connect relationships and logical conditions then you would end up dealing with quite the horrible run-on sentence much like the one you are reading right this very minute

Punctuation is your friend. Omitting semi-colons from Object Oriented code is acceptable "if" (and only "if") you have mature, compact code down to a science. I have seen the Nexus LUA code and yes, that is some very well written LUA. No semi-colons are needed there at all. However, most scripting/programming hobbyists can't achieve such elegance easily, so please, use your punctuation lol :shock:
proper punctuation means the difference between helping your uncle Jack, off a horse...and helping your uncle jack off a horse.

and I overuse ellipses as you have probably observed if you've been reading all the posts I make lately.
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: use of the semicolon

Post by minmay »

Azel wrote:Most of my LUA code is very much littered with semi-colons not only out of force of habit but also because I consider them to be proper identifiers for separating logical statements similar to using punctuation in standard writing and if you were to consider how even a basic communication typed in English would look that did not use a comma or period or semi-colon to separate one complete thought from another or to connect relationships and logical conditions then you would end up dealing with quite the horrible run-on sentence much like the one you are reading right this very minute
But Lua
like most other languages
already has a form of punctuation to separate statements:
line breaks
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: use of the semicolon

Post by Azel »

well I listed 3 things that punctuation helps, none of which are "statement separation"
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: use of the semicolon

Post by FeMaiden »

wow, I had no idea i would spark this discussion lol. I was merely confused about the semicolons. although now that I think about it, I may have had a similar discussion years ago in college while learning visual basic but I don't remember.


just on the subject, without offering my own opinion. I was under the impression that "redundant code is bad". meaning that anything you put in there that does not need to be there is just sloppy coding.
by that logic, semicolons are redundant in lua and it is sloppy to put them in. I'm merely saying this from an unbiased perspective.
Post Reply