Lua on the iPhone

前端 未结 4 960
情话喂你
情话喂你 2021-01-05 18:28

I\'m trying to load at run-time Lua scripts on the iPhone. Is there a possibility to do that?

How can I getting started with Lua? I can\'t find something. The only t

相关标签:
4条回答
  • 2021-01-05 18:51

    the Lua docs are very good, also read PIL (Programming in Lua) first edition is available online, the second edition is inexpensive on hard copy.

    Lua is specifically designed to be used as an embedded language, simply link to any C (or Obj-C, or C++) project, and use the C API to load scripts and run them.

    Note that Apple forbids to create scripting platforms; but AFAICT, that only means that the user shouldn't be able to add Lua scripts to enhance your app. You're free to use embedded Lua to make your App more flexible and easier to write.

    0 讨论(0)
  • 2021-01-05 18:54

    I have compiled Lua into an iPhone app. It is fairly straight forward if you have used Lua in other contexts. The only real gotcha is that the iPhone doesn't expose its file system in a traditional way so I ended up using the resource bundle to store scripts and had to rewrite the lua_dofile function to accept files from the bundle.

    I would recommend compiling Lua into a non-iPhone app before attempting to use it on the iPhone. Once you understand the c api shoehorning it into the cocoa mobile framework is not that hard.

    0 讨论(0)
  • 2021-01-05 18:59

    See also iPhone Wax: http://github.com/probablycorey/wax

    0 讨论(0)
  • 2021-01-05 19:01

    Check out the Corona SDK.

    0 讨论(0)
提交回复
热议问题