title: Beginning Lua: How to call functions from terminal on Mac OS?
body: <p>I'm new to Lua and work around with some tutorials, try some basic stuff like coding common algorithms etc.</p>
  
  <p>But I have some trouble while using the lua interpreter on my mac os machine.</p>
  
  <p>For example let's say we have a file called 'sample.lua', holds the code line:</p>
  
  <pre><code>function fib(n) return n&lt;2 and n or fib(n-1)+fib(n-2) end
  </code></pre>
  
  <p>How do I run that function from terminal?
  If I don't use any function, I just call the script with 'lua script.lua' - works!</p>
  
  <p>Next question points on the basic understanding between the usage of non-compiled and compiled lua-source. Why is lua code run without compiling, like I mentioned before (lua script.lua)? Or will this statement compile the code temporarily and run afterwards?</p>
  
  <p>Thanks in advance</p>
  
  <p>chris</p>