Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could I extend Corona with native code?

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...

like image 322
timestee Avatar asked Mar 13 '12 07:03

timestee


2 Answers

Corona doesn't allow extending with native code (yet) It is in their roadmaps, and it is supposed to be implemented in coming months

like image 143
SatheeshJM Avatar answered Sep 28 '22 09:09

SatheeshJM


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

like image 28
daven11 Avatar answered Sep 28 '22 09:09

daven11