How get parameter array (lua) in Objective C?

Hi, I’m iOS Developer. And sorry for my English, is very basic.

Now, I know Objective-C, but I need use Corona Enterprise in a project. I have a this problem, how get parameter int, boolean, NSArray, NSString,…

I open project this folder Corona Enterprise/Samples/SimpleLuaExtension/ios, but I don’t understading.

[main.lua]

local library = require “plugin.library”

library.print( {“Hello”,“world”,“everybody”} )

//-----------------------------------------

[XCode project ~ PluginLibrary.mm]

int PluginLibrary::print( lua_State *L )

{

–> How I get table from lua to C++? and from C++ to Objective C (NSArray)?

return 0;

}

I find information:

http://www.gamedev.net/topic/517292-passing-a-lua-table-as-an-argument-to-cc/

http://project-infant.blogspot.jp/2010/12/paso-parametros-entre-lua-y-c-tablas.html

But, how pass table lua to Objective c?

Please help me!! Thanks for your time.

I’m trying to get more information for you. 

Rob

This link may be of use. 

http://gusmueller.com/lua/luacore/Source/LuaObjCBridge.m

Rob

Thanks, I will read.

Thanks, Rob. I solved this problem.

[Solved]

int PluginLibrary:getArray( lua\_State \*L ) {    NSMutableArray \*arr = [[NSMutableArray alloc] init];    lua\_pushnil(L);    while(lua\_next(L, -2) != 0)    {       if(lua\_isstring(L, -1))          [arr addObject:[NSString stringWithUTF8String:lua\_tostring(L, -1)] ];       .....        // do the same with other types of data       lua\_pop(L, -1);    }    // print this array and show in console    return 0; }

Great! Congrats!

I’m trying to get more information for you. 

Rob

This link may be of use. 

http://gusmueller.com/lua/luacore/Source/LuaObjCBridge.m

Rob

Thanks, I will read.

Thanks, Rob. I solved this problem.

[Solved]

int PluginLibrary:getArray( lua\_State \*L ) {    NSMutableArray \*arr = [[NSMutableArray alloc] init];    lua\_pushnil(L);    while(lua\_next(L, -2) != 0)    {       if(lua\_isstring(L, -1))          [arr addObject:[NSString stringWithUTF8String:lua\_tostring(L, -1)] ];       .....        // do the same with other types of data       lua\_pop(L, -1);    }    // print this array and show in console    return 0; }

Great! Congrats!