probablycorey/wax

wax 3rd-party framework & Catalog supporting issue in hybrid project

arloan opened this issue · 2 comments

Since I'm using Xcode4, I don't know whether this is an xcode4 specific issue.

I'm using wax in a wax/objc hybrid project. n this project, I used an HTTP-client framework named LRResty(https://github.com/lukeredpath/LRResty). I dragged LRResty.framework from finder to my project, and did NOT select the 'copy files .... ' option. I can use this framework in objc code without problem, but I found I cannot use it in lua scripts.

I use this line of code to enable wax i(in - UIApplication didFinishLaunchingWithOptions:):

wax_start("init.lua", luaopen_wax_http, luaopen_wax_json, luaopen_wax_filesystem, nil);

and in init.lua, I wrote this line:

local resposne = LRResty:client():get("http://www.google.com/")

when I ran the project in iphone 4.3.2 simulator, I saw these in console output:

WARNING: No object named 'LRResty' found.
Error opening wax scripts: init.lua:5: attempt to index global 'LRResty' (a nil value)

I tried to add an dummy function in objc code to force load the framework:
void dummy { [[LRResty client] get:@""]; }
then another error cameout:

Error opening wax scripts: init.lua:5: attempt to call method 'get' (a nil value)

So, seem the framework has been found by wax, but wax cannot find the LRRestyClient::get: method.
I have to explain the the get: method is defined a catalog for class LRRestyClient, and I found I can successfully call
methods defined directly in non-catalog part of class LRRestyClient in lua script.

questions:

  1. Is there any way I can use 3rd-party framework in lua without write dummy codes in objc?
  2. Is the issue above a bug of wax specific to cataloges?
  3. If not, how can I use catalog in lua?

thanks.

Please do not ask why I use LRResty since wax has http client functions, I just use it to test wax capabilities with 3rd-party libraries. thanks.

Well, this is resoved by adding -all_load to the link settings, and LRRestyClient:get: synchronous call seems to hang on call, while this is another issue.