The lua programming language uses a freeform syntax. This means that whitespace characters, such as space, tab characters and newline characters can be inserted into the program code for the purpose of spacing, alignment or indentation in either the horizontal or vertical directions.
Line Breaks and IndentationEdit
The use of indentation and linebreaks can greatly improve the readability of the code, without affecting the way that the code performs. Using whitespace appropriately, makes the code easier to read and follow because at a glance it is very apparent where functions and procedures end, and which lines are part of which loops and procedures:
!!Example need here
Whitespace characters are ignored by the interpreterEdit
print "hello bob"
Line breaks are not permitted within a literal stringEdit
In lua, a line break is not permitted within a literal string:
-- This will produce an unfinished string error print "hello bob"
Whitespace is not permitted within an identifier nameEdit
It is not permissible to use whitespace in identifer names used for variables or functions:
-- function names cannot contain whitespace function my function(myparameter)
It is permissible to use underscore symbols in identifier names: