Merge pull request #9933 from SunLightJuly/support_func_call_chain

Support func call chain
This commit is contained in:
minggo 2015-01-13 09:35:12 +08:00
commit eb74647210
4 changed files with 58 additions and 29 deletions

View File

@ -62,7 +62,8 @@ int lua_cocos2dx_3d_Sprite3D_setBlendFunc(lua_State* L)
BlendFunc blendFunc = {src, dst}; BlendFunc blendFunc = {src, dst};
cobj->setBlendFunc(blendFunc); cobj->setBlendFunc(blendFunc);
return 0; lua_settop(L, 1);
return 1;
} }
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:setBlendFunc",argc, 2); luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:setBlendFunc",argc, 2);
return 0; return 0;
@ -167,7 +168,8 @@ int lua_cocos2dx_3d_AABB_reset(lua_State* L)
if(!ok) if(!ok)
return 0; return 0;
cobj->reset(); cobj->reset();
return 0; lua_settop(L, 1);
return 1;
} }
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.AABB:reset",argc, 0); luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.AABB:reset",argc, 0);
return 0; return 0;
@ -746,7 +748,8 @@ int lua_cocos2dx_3d_OBB_reset(lua_State* L)
if(!ok) if(!ok)
return 0; return 0;
cobj->reset(); cobj->reset();
return 0; lua_settop(L, 1);
return 1;
} }
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.OBB:reset",argc, 0); luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.OBB:reset",argc, 0);
return 0; return 0;

View File

@ -2077,7 +2077,8 @@ int tolua_cocos2d_Node_setContentSize(lua_State* tolua_S)
return 0; return 0;
cobj->setContentSize(size); cobj->setContentSize(size);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
else if(2 == argc) else if(2 == argc)
{ {
@ -2094,7 +2095,8 @@ int tolua_cocos2d_Node_setContentSize(lua_State* tolua_S)
return 0; return 0;
cobj->setContentSize(Size(width, height)); cobj->setContentSize(Size(width, height));
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setContentSize",argc, 1); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setContentSize",argc, 1);
@ -2135,7 +2137,8 @@ int tolua_cocos2d_Node_setAnchorPoint(lua_State* tolua_S)
return 0; return 0;
cobj->setAnchorPoint(pt); cobj->setAnchorPoint(pt);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
else if(2 == argc) else if(2 == argc)
{ {
@ -2152,7 +2155,8 @@ int tolua_cocos2d_Node_setAnchorPoint(lua_State* tolua_S)
return 0; return 0;
cobj->setAnchorPoint(cocos2d::Vec2(x,y)); cobj->setAnchorPoint(cocos2d::Vec2(x,y));
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setAnchorPoint",argc, 1); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setAnchorPoint",argc, 1);
@ -2261,7 +2265,8 @@ static int lua_cocos2dx_Node_enumerateChildren(lua_State* tolua_S)
return ret; return ret;
}); });
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "enumerateChildren",argc, 2); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "enumerateChildren",argc, 2);
return 0; return 0;
@ -2302,7 +2307,8 @@ int lua_cocos2dx_Node_setAdditionalTransform(lua_State* tolua_S)
if (!ok) { break; } if (!ok) { break; }
cobj->setAdditionalTransform(arg0); cobj->setAdditionalTransform(arg0);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
}while(0); }while(0);
ok = true; ok = true;
@ -2313,7 +2319,8 @@ int lua_cocos2dx_Node_setAdditionalTransform(lua_State* tolua_S)
if (!ok) { break; } if (!ok) { break; }
cobj->setAdditionalTransform(&arg0); cobj->setAdditionalTransform(&arg0);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
}while(0); }while(0);
ok = true; ok = true;
@ -2356,7 +2363,8 @@ int lua_cocos2dx_Node_setRotationQuat(lua_State* tolua_S)
if (!ok) { break; } if (!ok) { break; }
cobj->setRotationQuat(arg0); cobj->setRotationQuat(arg0);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
}while(0); }while(0);
@ -2410,7 +2418,8 @@ int lua_cocos2dx_Node_setPhysicsBody(lua_State* tolua_S)
return 0; return 0;
} }
cobj->setPhysicsBody(arg0); cobj->setPhysicsBody(arg0);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setPhysicsBody",argc, 1); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:setPhysicsBody",argc, 1);
return 0; return 0;
@ -2457,7 +2466,8 @@ int lua_cocos2dx_Node_removeFromPhysicsWorld(lua_State* tolua_S)
return 0; return 0;
} }
cobj->removeFromPhysicsWorld(); cobj->removeFromPhysicsWorld();
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:removeFromPhysicsWorld",argc, 0); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:removeFromPhysicsWorld",argc, 0);
return 0; return 0;
@ -3872,7 +3882,8 @@ int lua_cocos2dx_GLProgram_setUniformLocationWithMatrix2fv(lua_State* tolua_S)
cobj->setUniformLocationWithMatrix2fv(arg0, arg1, arg2); cobj->setUniformLocationWithMatrix2fv(arg0, arg1, arg2);
CC_SAFE_DELETE_ARRAY(arg1); CC_SAFE_DELETE_ARRAY(arg1);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWithMatrix2fv",argc, 3); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWithMatrix2fv",argc, 3);
return 0; return 0;
@ -3946,7 +3957,8 @@ int lua_cocos2dx_GLProgram_setUniformLocationWithMatrix3fv(lua_State* tolua_S)
cobj->setUniformLocationWithMatrix3fv(arg0, arg1, arg2); cobj->setUniformLocationWithMatrix3fv(arg0, arg1, arg2);
CC_SAFE_DELETE_ARRAY(arg1); CC_SAFE_DELETE_ARRAY(arg1);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWithMatrix3fv",argc, 3); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWithMatrix3fv",argc, 3);
return 0; return 0;
@ -4020,7 +4032,8 @@ int lua_cocos2dx_GLProgram_setUniformLocationWithMatrix4fv(lua_State* tolua_S)
cobj->setUniformLocationWithMatrix4fv(arg0, arg1, arg2); cobj->setUniformLocationWithMatrix4fv(arg0, arg1, arg2);
CC_SAFE_DELETE_ARRAY(arg1); CC_SAFE_DELETE_ARRAY(arg1);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWithMatrix4fv",argc, 3); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWithMatrix4fv",argc, 3);
return 0; return 0;
@ -4092,7 +4105,8 @@ int lua_cocos2dx_GLProgram_setUniformLocationWith3iv(lua_State* tolua_S)
cobj->setUniformLocationWith3iv(arg0, arg1, arg2); cobj->setUniformLocationWith3iv(arg0, arg1, arg2);
CC_SAFE_DELETE_ARRAY(arg1); CC_SAFE_DELETE_ARRAY(arg1);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWith3iv",argc, 3); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWith3iv",argc, 3);
return 0; return 0;
@ -4164,7 +4178,8 @@ int lua_cocos2dx_GLProgram_setUniformLocationWith4iv(lua_State* tolua_S)
} }
cobj->setUniformLocationWith4iv(arg0, arg1, arg2); cobj->setUniformLocationWith4iv(arg0, arg1, arg2);
CC_SAFE_DELETE_ARRAY(arg1); CC_SAFE_DELETE_ARRAY(arg1);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWith4iv",argc, 3); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWith4iv",argc, 3);
return 0; return 0;
@ -4233,7 +4248,8 @@ int lua_cocos2dx_GLProgram_setUniformLocationWith2iv(lua_State* tolua_S)
cobj->setUniformLocationWith2iv(arg0, arg1, arg2); cobj->setUniformLocationWith2iv(arg0, arg1, arg2);
CC_SAFE_DELETE_ARRAY(arg1); CC_SAFE_DELETE_ARRAY(arg1);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWith2iv",argc, 3); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgram:setUniformLocationWith2iv",argc, 3);
return 0; return 0;
@ -6578,7 +6594,8 @@ static int lua_cocos2dx_Console_addCommand(lua_State* tolua_S)
}; };
cobj->addCommand(outValue); cobj->addCommand(outValue);
} }
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Console:addCommand",argc, 2); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Console:addCommand",argc, 2);
return 0; return 0;
@ -6653,7 +6670,8 @@ static int lua_cocos2dx_GLProgramState_setVertexAttribPointer(lua_State* tolua_S
if(!ok) if(!ok)
return 0; return 0;
cobj->setVertexAttribPointer(arg0, arg1, arg2, arg3, arg4, (void*)&arg5); cobj->setVertexAttribPointer(arg0, arg1, arg2, arg3, arg4, (void*)&arg5);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
else if (argc == 7) else if (argc == 7)
{ {
@ -6713,7 +6731,8 @@ static int lua_cocos2dx_GLProgramState_setVertexAttribPointer(lua_State* tolua_S
CC_SAFE_DELETE(arg5); CC_SAFE_DELETE(arg5);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgramState:setVertexAttribPointer",argc, 6); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLProgramState:setVertexAttribPointer",argc, 6);
return 0; return 0;
@ -6927,7 +6946,8 @@ int lua_cocos2dx_TMXLayer_setTiles(lua_State* tolua_S)
cobj->setTiles(arg0); cobj->setTiles(arg0);
CC_SAFE_DELETE_ARRAY(arg0); CC_SAFE_DELETE_ARRAY(arg0);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXLayer:setTiles",argc, 1); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXLayer:setTiles",argc, 1);
return 0; return 0;

View File

@ -180,7 +180,8 @@ int lua_cocos2dx_physics_PhysicsWorld_rayCast(lua_State* tolua_S)
return 0; return 0;
cobj->rayCast(arg0, arg1, arg2, nullptr); cobj->rayCast(arg0, arg1, arg2, nullptr);
toluafix_remove_function_by_refid(tolua_S, handler); toluafix_remove_function_by_refid(tolua_S, handler);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "rayCast",argc, 4); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "rayCast",argc, 4);
return 0; return 0;
@ -236,7 +237,8 @@ int lua_cocos2dx_physics_PhysicsWorld_queryRect(lua_State* tolua_S)
return 0; return 0;
cobj->queryRect(arg0, arg1, nullptr); cobj->queryRect(arg0, arg1, nullptr);
toluafix_remove_function_by_refid(tolua_S, handler); toluafix_remove_function_by_refid(tolua_S, handler);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "queryRect",argc, 3); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "queryRect",argc, 3);
return 0; return 0;
@ -295,7 +297,8 @@ int lua_cocos2dx_physics_PhysicsWorld_queryPoint(lua_State* tolua_S)
return 0; return 0;
cobj->queryPoint(arg0, arg1, nullptr); cobj->queryPoint(arg0, arg1, nullptr);
toluafix_remove_function_by_refid(tolua_S, handler); toluafix_remove_function_by_refid(tolua_S, handler);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "queryPoint",argc, 3); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "queryPoint",argc, 3);
return 0; return 0;

View File

@ -364,7 +364,8 @@ static int lua_cocos2dx_spine_SkeletonAnimation_addAnimation(lua_State* tolua_S)
return 0; return 0;
cobj->addAnimation(arg0, arg1, arg2); cobj->addAnimation(arg0, arg1, arg2);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
if (argc == 4) if (argc == 4)
{ {
@ -385,7 +386,8 @@ static int lua_cocos2dx_spine_SkeletonAnimation_addAnimation(lua_State* tolua_S)
cobj->addAnimation(arg0, arg1, arg2, arg3); cobj->addAnimation(arg0, arg1, arg2, arg3);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "addAnimation",argc, 3); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "addAnimation",argc, 3);
return 0; return 0;
@ -440,7 +442,8 @@ static int lua_cocos2dx_spine_SkeletonAnimation_setAnimation(lua_State* tolua_S)
cobj->setAnimation(arg0, arg1, arg2); cobj->setAnimation(arg0, arg1, arg2);
return 0; lua_settop(tolua_S, 1);
return 1;
} }
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "setAnimation",argc, 3); luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "setAnimation",argc, 3);
return 0; return 0;