tolua手册
http://www.codenix.com/~tolua/tolua++.html#classes


InBlock.gifMultiple returned values
InBlock.gif
In Lua, a function may return any number of values. tolua uses this feature to simulate values passed by reference. If a function parameter is specified as a pointer to or reference of a basic type or a pointer to or reference of a pointer to an user defined type, tolua accepts the corresponding type as input and returns, besides the conventional function returned value, if any, the updated parameter value.
InBlock.gifFor instance, consider a C function that swaps two values:
InBlock.gif
void swap (double* x, double* y);
InBlock.gif
or
InBlock.gif
void swap (double& x, double& y);
InBlock.gif
If such a function is declared in the package file, tolua binds it as a function receiving two numbers as input and returning two numbers. So, a valid Lua code would be:
InBlock.gif
x,y = swap(x,y)
InBlock.gif
If the input values are not used, the use of default parameter value allows calling the function from Lua without specifying them:
InBlock.gif
void getBox (double* xmin=0, double* xmax=0, double* ymin=0, double* ymax=0);
InBlock.gif
In Lua:
InBlock.gif
xmin, xmax, ymin, ymax = getBox()
InBlock.gif
With user defined types, we would have for instance:
InBlock.gif
void update (Point** p);
InBlock.gif
or
InBlock.gif
void update (Point*& p);


这是cpp
RectArrayStruct  Animation::GetCurrentFrameAttackInfo(  int *x , int *y , int *w , int *h  ) {
//这里是tolua的固定多个返回值的写法
RectArrayStruct ss = animationAttackArray[actionIndex ][frameIndex].attackArray[0];
*x = ss.x;
*y = ss.y;
*w = ss.w;
*h = ss.h;
return animationAttackArray[actionIndex ][frameIndex].attackArray[0];
}

.h
RectArrayStruct  GetCurrentFrameAttackInfo(  int *x =0, int *y =0, int *w =0, int *h =0);

.pkg
void  GetCurrentFrameAttackInfo(   int *x =0, int *y =0, int *w =0, int *h =0 );

.lua
 local sss, s2,s3,s4 =  self.animation:GetCurrentFrameAttackInfo(0)

就可以把x,y,w,h当成返回值, 传给lua了