Skip to content

Commit

Permalink
improved return values management
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeioris committed Feb 1, 2019
1 parent ceba6e1 commit a2499e5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
Binary file added Content/Code/TestProxyCall.uasset
Binary file not shown.
Binary file modified Content/LuaMachine_Tests.umap
Binary file not shown.
Binary file modified Content/LuaTestActor.uasset
Binary file not shown.
Binary file added Content/Tests/TestMultiArgs.uasset
Binary file not shown.
16 changes: 9 additions & 7 deletions Source/LuaMachine/Private/LuaState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,13 +687,11 @@ int ULuaState::MetaTableFunction__call(lua_State *L)
FLuaValue LuaValue = LuaState->ToLuaValue(i);
*LuaProp->ContainerPtrToValuePtr<FLuaValue>(ArrayHelper.GetRawPtr(i - StackPointer)) = LuaValue;
}

break;
}
continue;
break;
}
if (LuaProp->Struct != FLuaValue::StaticStruct())
continue;
break;

FLuaValue LuaValue = LuaState->ToLuaValue(StackPointer++);
*LuaProp->ContainerPtrToValuePtr<FLuaValue>(Parameters) = LuaValue;
Expand Down Expand Up @@ -738,6 +736,10 @@ int ULuaState::MetaTableFunction__call(lua_State *L)
if (!Prop->HasAnyPropertyFlags(CPF_ReturnParm | CPF_OutParm))
continue;

// avoid input args (at all costs !)
if (Prop->HasAnyPropertyFlags(CPF_ConstParm | CPF_ReferenceParm))
continue;

UStructProperty* LuaProp = Cast<UStructProperty>(Prop);
if (!LuaProp)
{
Expand All @@ -758,13 +760,13 @@ int ULuaState::MetaTableFunction__call(lua_State *L)
LuaState->FromLuaValue(*LuaValue);
}

break;

}
continue;
break;
}

if (LuaProp->Struct != FLuaValue::StaticStruct())
continue;
break;

FLuaValue* LuaValue = LuaProp->ContainerPtrToValuePtr<FLuaValue>(Parameters);
if (LuaValue)
Expand Down

0 comments on commit a2499e5

Please sign in to comment.