Lua Logo
Comments - Keywords


nach obenComments



In every programming language so called comments are existing. In large scripts they can be used for a better overview. Other people will have a better understanding of you have done in your script.


Every programming language has its own characters, who tell the interpreter that the following (comment) is not really necessary. As we are learning LUA, here it is for LUA:



-- everything behind this, wil not been red by the interpreter

(but it is only valid for this line)



If we want to create a comment of more than one line, we use --[[ for the beginning and ]] for finishing the comment. We remind of the string: it is a similar way, but there we do not use the two hyphen.




Another convenient application for comments is, if we do not want to execute a special part of our script. Then we make an according comment for these lines, before deleting them or using them in our script.


Let us create a comment at the editor. You see, that the line is turning green. Good to know. ;)



nach obenKeywords



We already have learned that some words are reserved. Keywords are reserved as well and wvery programming language has its own. Following please find the keywords at LUA:


and break do else elseif

end false for function if

in local nil not or

repeat return then true until while





Enter these words in the Editor. Then you will see, that the editor knows them as keywords and turns them blue. This is also very convenient for the overview.


local function and end we already have learned as well.



Now we got a little bit curios and we try to enter numbers and strings as well in the editor. If their colour will also change?

Copying of any content of this site (text or graphics) is not allowed, excepted any source code shown in this tutorial. See also: ....Disclaimer
Copyright © Robert Schmitz 2006