How to use LUA_FUNCTION in tolua++?

I defined the pkg file with

void registerFunctionOnClick(LUA_FUNCTION fun);

Like the sdk\tools\tolua++.pkg writed

void registerScriptHandler(LUA_FUNCTION funcID);

But it caused some error when compiled, such as “undeclared identifier ‘_lua_function’”.

Could any one tell me why?

For cocos2d-2.0-x-2.0.3:

You need to use basic.lua. It registers LUA_FUNCTION to be custom type, that is mapped using functions defined in tolua_fix.h.
Take a look at tools\toluaand tools\tolua.php.

On the C++ side you need to include CCLuaEngine.h, LUA_FUNCTION is defined there.

Simon - wrote:

For cocos2d-2.0-x-2.0.3:
>
You need to use basic.lua. It registers LUA_FUNCTION to be custom type, that is mapped using functions defined in tolua_fix.h.
Take a look at tools oluaREADME and tools oluauild.php.
>
On the C++ side you need to include CCLuaEngine.h, LUA_FUNCTION is defined there.

Yes I see, Thank you my friend. :smiley: