Skip to main content

How to embed iPhone-Wax into app



I have just learnt about iPhone-Wax (thanks to SO). Now the documentation is rather sparse for what I am trying to do.





I want to embed it into an Objective-C app. I don't want it to be the main app. Has anyone done it and how can I achieve it?





I would like to use it in the same way LuaObjectiveCBridge is used.


Comments

  1. If I understand correctly, you want to create an ad-hoc Lua class?! It is as simple as this:

    you have a Lua script (script.lua):

    waxClass{"LuaClass"}
    function myMethod(self, object)
    object:doSomething()
    end


    and in your obj-c code:

    ...
    luaL_dofile(wax_currentLuaState(), "script.lua");
    MyClass *o = [[MyClass alloc] init];
    Class LuaClass = NSClassFromString(@"LuaClass");
    id luaObject = [[LuaClass alloc] init];
    [luaObject performSelector:@selector(myMethod:) withObject:o];
    ...


    Check this gist wrote by Corey.

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?