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


Multiple returned values

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.
For instance, consider a C function that swaps two values:

void swap (double* x, double* y);

or

void swap (double& x, double& y);

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:

x,y = swap(x,y)

If the input values are not used, the use of default parameter value allows calling the function from Lua without specifying them:

void getBox (double* xmin=0, double* xmax=0, double* ymin=0, double* ymax=0);

In Lua:

xmin, xmax, ymin, ymax = getBox()

With user defined types, we would have for instance:

void update (Point** p);

or

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了