I have some function module written in Objective-c, could i wrap the objective-C by C++, then integrate C/C++ code with Lua using toLua++, then using the lua code in Corona? Could i do that? It seems impossible...
Asked
Active
Viewed 1,496 times
2 Answers
2
Corona doesn't allow extending with native code (yet) It is in their roadmaps, and it is supposed to be implemented in coming months

SatheeshJM
- 3,575
- 8
- 37
- 60
-
Almost 3 years later, I am wondering if this has been implemented? – SullX Apr 09 '15 at 20:34
1
you could make a shared library, then just require it into your code.
e.g. create mylibrary.so
then in lua
require("mylibrary")
lua will look for it in your LUA_PATH.
There are a few things I'm not sure of in corona - if it will load a shared library and you can use toLUa++. It will work fine in normal lua. You might have problems with bindings in the shared library to Cocoa - not sure, not something I've tried. I've built a .dll in windows and it worked fine - again not in corona.
Here's how to build a shared library
It seems like corona will do it - have a look here
this could be the stopper though - no shared libraries on iOS
hth
-
1
-
yah but corona is lua with some libraries as far as I understand. The kicker is that you can't have shared libraries on iOS, unless someones figured out a hack. You could conceivably make your own corona shell and statically link your library, this would be hard :-( – daven11 Mar 21 '12 at 09:36
-
1@daven11: [Not all parts of Lua are included.](http://developer.anscamobile.com/content/changes-lua). `require` is preprocessed when you "build", I believe (with Corona, you have to submit your code to their servers to get back a working app). – Mud May 22 '12 at 15:55