Functions are the core of any good program or script. Functions in LUA are in the following format
function name() -- some stuff end
function max(num1, num2) if (num1 > num2) then return num1; else return num2; end end -- invoke : print("The max: ",max(10,4))
You might have noticed we could drastically simplify the above function by using a ternary operator. Unfortunately there is no ternary operator in LUA.