Can you call more than one obj cfunction from Lua?

Coming form Win8, I have been trying to replicate how I call any number of native functions from Lua. I have tried changing the name of the id from coronaView to coronaView2 and changing the message to the same on the Lua side but it doesn’t work. I have tried to grab the string and turn it to a sector but it  looks like I can only send a method to an object, not just call one. For instance in Win8, I could do just use the message name and call that function and have as many as i want like this. I cant seem to find a way being a complete Xcode novice:

LUA:

function()Runtime:dispatchEvent({name=“nameOfFunctionToCallSentFromLuaAsString”});end,

//code which loads the chosen function

        private void OnCoronaRuntimeLoaded(object sender, CoronaLabs.Corona.WinRT.CoronaRuntimeEventArgs e)

        {

            e.CoronaRuntimeEnvironment.AddEventListener(“nameOfFunctionToCallSentFromLuaAsString”, doFunctionInNative);

       

        }

//chosen function

        private CoronaLabs.Corona.WinRT.ICoronaBoxedData doFunction(

        CoronaLabs.Corona.WinRT.CoronaRuntimeEnvironment sender, CoronaLabs.Corona.WinRT.CoronaLuaEventArgs e)

        {

            return null;

        }

Unfortunately no.  The ability to listen to *any* dispatched Lua events (not just your own, but Corona’s built-in ones such as “enterFrame”) is unique to WP8 CoronaCards.

On Android and iOS CoronaCards, you can only communicate to the native CoronaView class via a Lua “coronaView” event.  Now, you can add an additional parameter to your “coronaView” event table to identify the type of event it is.  That might help you.  Or you could add your own custom Lua library and functions as shown in our Corona Enterprise “SimipleLuaExtension” sample project.  The Android version of that sample project shows a lot of example on how to work directly with the Lua state.  Not as simple as using a “coronaView” event, but it’s the most powerful approach.  And if you ever intend to do plugins in the future, learning how to work with the Lua state is actually a requirement.

Hi. I’ve learnt quite since I last posted. I now send anything tagged on to the event send to obj c. And then I just have conditions checking the object at key “event” . It’s pretty responsive so I’m fine with that.

Unfortunately no.  The ability to listen to *any* dispatched Lua events (not just your own, but Corona’s built-in ones such as “enterFrame”) is unique to WP8 CoronaCards.

On Android and iOS CoronaCards, you can only communicate to the native CoronaView class via a Lua “coronaView” event.  Now, you can add an additional parameter to your “coronaView” event table to identify the type of event it is.  That might help you.  Or you could add your own custom Lua library and functions as shown in our Corona Enterprise “SimipleLuaExtension” sample project.  The Android version of that sample project shows a lot of example on how to work directly with the Lua state.  Not as simple as using a “coronaView” event, but it’s the most powerful approach.  And if you ever intend to do plugins in the future, learning how to work with the Lua state is actually a requirement.

Hi. I’ve learnt quite since I last posted. I now send anything tagged on to the event send to obj c. And then I just have conditions checking the object at key “event” . It’s pretty responsive so I’m fine with that.