title: Lua on the iPhone?
body: <p>I am trying to use Lua on the iPhone. On Mac OS X, in a normal (non-iOS) Cocoa application, I used the following code:</p>
  
  <pre><code>lua_State* l;
  l = lua_open();
  luaL_openlibs(l);
  luaL_loadstring(l, "print(\"Hi from Lua\");");
  lua_pcall(l, 0, 0, 0);
  </code></pre>
  
  <p>I downloaded Lua 5.1.4 from lua.org/ftp and compiled it for Mac OS X.
  In the Xcode project, I used "Add Existing Framework" to add <code>liblua.a</code> and I used "Add Existing Files" to add the include directory.</p>
  
  <p>This works as expected, and prints the string: "Hi from Lua".
  When I try the same thing in an iOS project, it gives the errors:</p>
  
  <pre><code>"_luaL_newstate", referenced from:
  _main in main.o
  more of the same thing...
  symbol(s) not found
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>It seems that the .a file is not linked into the iPhone app.
  Does anybody know how to make this work?</p>
  
  <p>(By the way, I don't really care that Apple might not accept my app if it has Lua in it.)</p>