A function is essentially a named chunk of code. Unlike other chunks, the contents of a function are not automatically executed when the file is loaded. When a file is first loaded, functions are simply defined. Once a function has been defined, you can execute the function by calling it. Because a function is a named chunk, you can call a function as many times as you want. The same scope rules apply to functions as to do/end blocks.
Read more about functions online at https://www.lua.org/pil/5.html.