From 4eb7e8622bbf61f143ccfcc6cd0b8a697610fade Mon Sep 17 00:00:00 2001 From: forsakenyang Date: Fri, 27 May 2022 11:41:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E5=B8=A6=E8=BF=94=E5=9B=9E=E5=80=BC=E7=9A=84=E5=A7=94=E6=89=98?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=97=A0=E6=B3=95=E4=BB=8Elua=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UnLua/Private/ReflectionUtils/FunctionDesc.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Plugins/UnLua/Source/UnLua/Private/ReflectionUtils/FunctionDesc.cpp b/Plugins/UnLua/Source/UnLua/Private/ReflectionUtils/FunctionDesc.cpp index 9703e5ea..0c172a09 100644 --- a/Plugins/UnLua/Source/UnLua/Private/ReflectionUtils/FunctionDesc.cpp +++ b/Plugins/UnLua/Source/UnLua/Private/ReflectionUtils/FunctionDesc.cpp @@ -651,11 +651,12 @@ bool FFunctionDesc::CallLuaInternal(lua_State *L, void *InParams, FOutParmRec *O int32 NumResultOnStack = lua_gettop(L); if (NumResult <= NumResultOnStack) { -#if UNLUA_LEGACY_RETURN_ORDER int32 OutPropertyIndex = -NumResult; -#else - int32 OutPropertyIndex = NumResult; +#if !UNLUA_LEGACY_RETURN_ORDER + if (ReturnPropertyIndex > INDEX_NONE) + OutPropertyIndex++; #endif + OutParam = OutParams; for (int32 i = 0; i < OutPropertyIndices.Num(); ++i) @@ -686,11 +687,7 @@ bool FFunctionDesc::CallLuaInternal(lua_State *L, void *InParams, FOutParmRec *O } OutParam = OutParam->NextOutParm; } -#if UNLUA_LEGACY_RETURN_ORDER ++OutPropertyIndex; -#else - --OutPropertyIndex; -#endif } } @@ -708,7 +705,7 @@ bool FFunctionDesc::CallLuaInternal(lua_State *L, void *InParams, FOutParmRec *O #if UNLUA_LEGACY_RETURN_ORDER constexpr auto IndexInStack = -1; #else - constexpr auto IndexInStack = 1; + const auto IndexInStack = -NumParams; #endif // set value for blueprint side return property