title: "main" function in Lua?
body: <p>In python, one would usually define a main function, in order to allow the script to be used as module (if needed):</p>
  
  <pre><code>def main():
      print("Hello world")
      return 0
  
  if __name__ == "__main__":
      sys.exit(main())
  </code></pre>
  
  <p>In Lua, the idiom <code>if __name__ == "__main__"</code> isn't possible as such (that means, I don't think it is).</p>
  
  <p>That's what I'm usually doing in order to have a similar behaviour in Lua:</p>
  
  <pre><code>os.exit((function(args)
      print("Hello world")
      return 0
  end)(arg))
  </code></pre>
  
  <p>... But this approach seems rather "heavy on parentheses" :-)</p>
  
  <p>Is there a more common approach (besides defining a global main function, which seems redundant)?</p>