This is a central concept in writing good code. A function allows you to make a small piece of code which does one thing well and often can be reused if the same functionality is needed in multiple places. Functions apply a core design principal: /wiki/spaces/IXB/pages/3181903910.
Functions are Block statements.
Here’s a simple example:
function APPhello() return "Hello"; end
Arguments are variables which are used to pass data into a function. You can optionally define the function as local to limit its scope:
function APPadd(a,b) return a + b end local sum = APPadd(2,3) --returns 5
Notice in the above example, the function returned the resulting value.