Build HelloLua on Linux.

Build HelloLua on Linux.
0.0 0


Dear everyone here,

I am a new guy to Cocos2d-x, and I am a linux user. When I start to learn Cocos2d-x, I found that TestCpp and HelloCpp both have the linux project, but others not. So I tried to add linux project for every sample code.

The first I tried to do this is HelloLua. I modified the project under HelloCpp, include the main.cpp/main.h and Makefile, and add all needed file there. But there is a bug in LuaCocos2d.cpp which is under scripting/lua/cocos2dx_support. At line 42184, the va_list assignment is a tricky method to used. because the standard method is use va_start to initialzed the va_list.

This method will fail when the code is compiled under linux x86_64, because the va_list is defined as a array, not a pointer. I do a trick here to use a non-standard macro: va_copy, and the code is modified like this:

va_list args;
#ifdef LINUX
va_copy(args, tolua_tousertype));
args =
((va_list*) tolua_tousertype(tolua_S,3,0));

This code is tested under my ubuntu 12.10 x86_64 and VC 2010 under WinXP 32bit.
I Don’t know if it will work under other platform. And there is another snippet like this
in the next function, but I cannot tell the line number.

I also want to submit my proj.linux for HelloLua and maybe other samples later, how could I do this?

Thank you !

Holmes Conan.