Creating Lua bindings--I have some questions about what to do.

Hello, I’m a new user to Cocos2d-x, and I’m interested in writing games in Lua.

I’d like to help complete more Lua bindings for SimpleAudioEngine and Box2D. It looks like people have started this in the past, but became hung up on one thing or another. If I can get this working, how would submissions to the git repo work?

I’ve never used tolua*+ before, but I’ve got it compiled for OSX now, and I’m trying to understand the tool pipeline for generating and using the bindings. I have some questions—
* It looks like ‘ant’ should be used for generating and copying the Cocos2d.pkg. But, SimpleAudioEngine.pkg looks like it has to be generated with a separate command line such as: tolua*+ tSimpleAudioEngineo LuaSimpleAudioEngine.cpp SimpleAudioEngine.pkg, and then copied by hand.
Is this correct? Should it be incorporated into the ant build.xml?

  • The header files for the tolua++ output .cpp files look like they’re generated by hand, and just have to include useful headers and the prototype:
    int tolua**open(lua_State* toLua_S);
    Is this correct?

  • lua/CocosDenshion_support/LuaSimpleAudioEngine.h uses the idempotent header define LUADENSHION_H, which is probably wrong and should be changed to LUASIMPLEAUDIOENGINE_H, correct?

Again, I’d like to help where I can. I think Cocos2d-x is a really great idea, and it will help me get my own engine running.

Thanks,
Sean

Thanks Sean. Please feel free to improve cocos2d-x and push request to github.com/cocos2d/cocos2d-x repo.

Walzer, could you answer the questions I have above?

  • It looks like ‘ant’ should be used for generating and copying the Cocos2d.pkg. But, SimpleAudioEngine.pkg looks like it has to be generated with a separate command line such as: tolua++ tSimpleAudioEngineo LuaSimpleAudioEngine.cpp SimpleAudioEngine.pkg, and then copied by hand.
    Is this correct? Should it be incorporated into the ant build.xml?

*The header files for the tolua++ output .cpp files look like they’re generated by hand, and just have to include useful headers and the prototype:
int tolua
*open;
Is this correct?
** lua/CocosDenshion_support/LuaSimpleAudioEngine.h uses the idempotent header define LUADENSHION_H, which is probably wrong and should be changed to LUASIMPLEAUDIOENGINE_H, correct?

Yes, I think we should add build.xml for SimpleAudoEngine.pkg, would you implement it?

Minggo Zhang wrote:

Yes, I think we should add build.xml for SimpleAudoEngine.pkg, would you implement it?

My apologies. I didn’t get a reply when I was working on this stuff and hadn’t checked back, and inevitably moved onto other things. Now I’m back writing a game using the JS bindings though :wink: