Fabrizio Farinelli
Fabrizio Farinelli

Reputation: 251

Lua on the iPhone

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 thing I can find is that this should be possible, but I am wondering how.

Upvotes: 6

Views: 4246

Answers (4)

Nick Van Brunt
Nick Van Brunt

Reputation: 15464

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.

Upvotes: 3

Alexander Gladysh
Alexander Gladysh

Reputation: 41383

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

Upvotes: 4

lhf
lhf

Reputation: 72312

Check out the Corona SDK.

Upvotes: 7

Javier
Javier

Reputation: 62583

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.

Upvotes: 4

Related Questions