lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi All,

I'm new to this list and just started on Lua a few months ago. I'm writing a library using Obj-C and I'm trying to use the LuaObjCBridge (on Intel Mac). I have successfully compiled the framework, linked it into my Lua module and loaded the module in the standalone interpreter I'm using. I can create an object from Lua, and call its member functions so all that seems to work fine.

The only problem is, I can't call any functions with more than 1 argument. In such case I get an error: "Receiver does not implement method."



require("luandi") -- my module

button = objc.class("NDIRectangle"):alloc()
button:init()
 
button:alive() -- OK
button:testfloat(666.0) -- OK

print(button:x()) -- OK
print(button:width()) --OK

button:testtwoints(34, 34) -- ERROR
button:testfloatfloat(3233.0, 43.0) -- ERROR



The only odd thing I found was that I had to edit the following in LuaObjCBridge.m otherwise "objc" wasn't a valid table in Lua:

int lua_objc_open(lua_State* state){

    #if LUA_OBJC_LUA_DEPLOYMENT_TARGET>=LUA_OBJC_LUA_VERSION_5_1_0
        // change this line :
        // luaL_register(state,lua_tostring(state,-1),lua_objc_functions);

        // into this line :
        luaL_register(state,LUA_OBJC_LIBRARY_NAME,lua_objc_functions);

    #else
        luaL_openlib(state,LUA_OBJC_LIBRARY_NAME,lua_objc_functions,0);
   
    #endif
 
    return 0;
}

 
Does anybody have a clue? I've tried everything to make sure I wasn't doing something stupid, but I'm really stuck. Is there anything obvious I might be missing? Anyone using LuaObjCBridge on Intel Mac successfully?

Cheers,
Thijs