Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

蓝图传数组参数给lua,数组为空问题仍然存在 #404

Closed
BulletHermit opened this issue May 8, 2022 · 8 comments
Closed

蓝图传数组参数给lua,数组为空问题仍然存在 #404

BulletHermit opened this issue May 8, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@BulletHermit
Copy link

比如在蓝图定义一个非空的数组全局变量Array。然后再定义一个空的函数(名字Bar)给脚本覆盖,这个函数有一个数组类型的输入参数。
在蓝图调用Bar时把数组变量Array传进去,此时在脚本Bar函数打印传进来的数组变量的长度,输出为0,传过来的数组是空的。

(看了下之前有人提过这个问题,说2.0preview解决了,但是我用2.1.4还是有这个问题)

@xuyanghuang-tencent
Copy link
Collaborator

#401 同一个问题

@xuyanghuang-tencent xuyanghuang-tencent added pending release This will be released on next version bug Something isn't working labels May 10, 2022
@BulletHermit
Copy link
Author

这个问题修复了,另一个问题依然存在:某蓝图函数bfunc的返回值是数组时,lua重写返回数组,在蓝图上调用bfunc,返回的数组还是空的,重现步骤:
1.蓝图创建一个简单函数GetArrayFunction,参数是一个int数组,返回值是一个int数组
image

2.蓝图调用GetArrayFunction,如下图
image
3.lua重写如下
image
4.打印结果如下,说明数组参数的传入是正常的,但是返回数组结果不正常
image

@xuyanghuang-tencent
Copy link
Collaborator

第一张图里的Array ParamArray Result之间没有连线?

@BulletHermit
Copy link
Author

没有,我只是测试下,蓝图传入lua参数和lua返回到蓝图参数的过程,有没有问题。应该说是,在lua中创建一个数组,作为返回值返回时,蓝图接收到的是空值

@xuyanghuang-tencent
Copy link
Collaborator

试试把Array Result重命名为ReturnValue

@BulletHermit
Copy link
Author

这个我明天试试,我现在是这里改了下:
Property->GetValue(L, InParams, false);
改成
Property->GetValue(L, InParams, !Property->IsReferenceParameter());
image

@xuyanghuang-tencent
Copy link
Collaborator

image
当蓝图里定义的返回参数名字为ReturnValue时,会被认为这是函数传统意义上的返回值,其他的会被认为是Out参数,之前没有考虑到这种情况

@xuyanghuang-tencent
Copy link
Collaborator

v2.2.1

@xuyanghuang-tencent xuyanghuang-tencent removed the pending release This will be released on next version label Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants