xLua icon indicating copy to clipboard operation
xLua copied to clipboard

Hotfix 参数带params修饰符的函数时,参数传递不正确

Open newbeginnerfuqing opened this issue 2 years ago • 1 comments

原函数如下: public override Vector2 GetRealHeight(params object[] parameters) { ...

    ...
}

xlua的fix函数如下: function ClsHotFix:GetRealHeightEx(parameters) ...

...

end

断点时看到,传入参数应为一个数组,但是xlua内并不能读取到数组,仅为parameters数组内首个值,这里有办法获得整个数组嘛?

### Tasks

newbeginnerfuqing avatar Jun 30 '23 09:06 newbeginnerfuqing

估计是你传入的数组, 协变为了object[]类型正好嵌合params object[]参数, 这是在C#编译器层面发生的和xlua无关. 你可以在传参数加上强转试试xxx.GetRealHeight((object)anyArray);

throw-out avatar Jul 05 '23 09:07 throw-out