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

TArray引用做返回值或参数在lua中修改不生效 #362

Closed
jozhn opened this issue Feb 11, 2022 · 0 comments
Closed

TArray引用做返回值或参数在lua中修改不生效 #362

jozhn opened this issue Feb 11, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@jozhn
Copy link
Contributor

jozhn commented Feb 11, 2022

当UFUNCTION返回值是TArray&,或者委托参数是TArray&时,lua中接收然后对TArray进行操作(如增删),C++中没有发生改变。
UFUNCTION返回值这个是一直都存在问题,委托参数是unlua2.0之后出现问题。

C++:

UFUNCTION()
TArray<int32>& GetArray()
{
    return TestArray;
}

Lua:

local array = self:GetArray()
array:Add(1)
array:Add(2)
array:Add(3)
print(array:Length())

Lua中length是3,但C++中获取的是0。

@jozhn jozhn changed the title TArray引用做返回值在lua中修改不生效 TArray引用做返回值或参数在lua中修改不生效 Feb 11, 2022
xuyanghuang-tencent added a commit that referenced this issue Feb 24, 2022
@xuyanghuang-tencent xuyanghuang-tencent added bug Something isn't working pending release This will be released on next version labels Mar 1, 2022
@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