PDA

View Full Version : ) and ; question



Visvalor
May 12th, 2011, 17:09
I was digging in my old ruleset, and I've realized that only some of my )'s have ; ending it. Don't all of them need it? I can't recall

Shouldn't



<script>
function update()
DBaseCheck = source.getValue()
setValue(DBaseCheck)
end
function onInit()
setVisible(false);
source = window.getDatabaseNode().getChild("stats.understanding")
source.onUpdate = update
update()
end
</script>


Be



<script>
function update();
DBaseCheck = source.getValue();
setValue(DBaseCheck);
end
function onInit();
setVisible(false);
source = window.getDatabaseNode().getChild("stats.understanding");
source.onUpdate = update
update();
end
</script>

drahkar
May 12th, 2011, 17:49
Function lines do not get them. Nor does the end line. But most of the others should. I've gotten the impression that they have coded the engine that it can work around it, but the code is cleaner and less likely to potentially develop issues if you adhere to the Lua standard that wants it there.

StuartW
May 12th, 2011, 22:08
The Lua standard doesn't require a terminating semi-colon:


The unit of execution of Lua is called a chunk. A chunk is simply a sequence of statements, which are executed sequentially. Each statement can be optionally followed by a semicolon
Stuart

drahkar
May 12th, 2011, 23:06
Curses. Foiled by my apparent personal bias for trailing semi-colons in my code!

phantomwhale
May 13th, 2011, 00:33
Have spent much of my time on the SWEX codebase removing the ungodly things.

Probably a reaction to being told by countless academic language compilers that my code didn't compile due to a missing ';' - well, if can figure out one is missing, why don't you just put it back IN then Mr clever-boots compiler.