-
Notifications
You must be signed in to change notification settings - Fork 133
Open
Description
ULuaState::ToFProperty(void* Buffer, FProperty * Property, FLuaValue Value, bool& bSuccess, int32 Index)
Line: 2421 - 2440
#if ENGINE_MAJOR_VERSION > 4 || ENGINE_MINOR_VERSION >= 25
if (FMapProperty* MapProperty = CastField<FMapProperty>(Property))
#else
if (UMapProperty* MapProperty = Cast<UMapProperty>(Property))
#endif
{
FScriptMapHelper_InContainer Helper(MapProperty, Buffer, Index);
Helper.EmptyValues();
TArray<FLuaValue> TableKeys = ULuaBlueprintFunctionLibrary::LuaTableGetKeys(Value);
for (FLuaValue TableKey : TableKeys)
{
int32 NewIndex = Helper.AddUninitializedValue();
uint8* KeyBuffer = Helper.GetKeyPtr(NewIndex);
uint8* ValueBuffer = Helper.GetValuePtr(NewIndex);
bool bTableItemSuccess = false;
ToProperty(KeyBuffer, Helper.GetKeyProperty(), TableKey, bTableItemSuccess, 0);
ToProperty(ValueBuffer, Helper.GetValueProperty(), TableKey, bTableItemSuccess, 0); <-- crash?
}
return;
}
this crash occurs when a cpp function has an argument of type struct and the struct has a member of type TMap while providing a table as an argument when calling from lua like so:
local o = GetSomeObject()
local t = {["key"] = "value"}
o.CPPCrashMethod(t)
cpp:
USTRUCT(BlueprintType)
struct FTestLuaCrash
{
GENERATED_BODY()
public:
TMap<FString, FString> map;
};
//method
void USomeObject::CPPCrashMethod(FTestLuaCrash inStruct)
{
//should crash by calling this
return;
}
callstack:
VCRUNTIME140
UnrealEditor_LuaMachine!FString::operator=() [D:\UE_5.6\Engine\Source\Runtime\Core\Public\Containers\UnrealString.h.inl:76]
UnrealEditor_LuaMachine!ULuaState::ToFProperty() [C:\Users\User\Documents\Unreal Projects\UEPROJECT\Plugins\LuaMachine\Source\LuaMachine\Private\LuaState.cpp:2294]
UnrealEditor_LuaMachine!ULuaState::ToFProperty() [C:\Users\User\Documents\Unreal Projects\UEPROJECT\Plugins\LuaMachine\Source\LuaMachine\Private\LuaState.cpp:2436]
UnrealEditor_LuaMachine!ULuaState::LuaTableToStruct() [C:\Users\User\Documents\Unreal Projects\UEPROJECT\Plugins\LuaMachine\Source\LuaMachine\Private\LuaState.cpp:2476]
UnrealEditor_LuaMachine!ULuaState::ToFProperty() [C:\Users\User\Documents\Unreal Projects\UEPROJECT\Plugins\LuaMachine\Source\LuaMachine\Private\LuaState.cpp:2400]
UnrealEditor_LuaMachine!ULuaState::MetaTableFunction__rawcall() [C:\Users\User\Documents\Unreal Projects\UEPROJECT\Plugins\LuaMachine\Source\LuaMachine\Private\LuaState.cpp:1284]
UnrealEditor_LuaMachine!luaD_precall()
UnrealEditor_LuaMachine!luaV_execute()
UnrealEditor_LuaMachine!luaD_callnoyield()
UnrealEditor_LuaMachine!luaD_rawrunprotected()
UnrealEditor_LuaMachine!luaD_pcall()
UnrealEditor_LuaMachine!lua_pcallk()
UnrealEditor_LuaMachine!ULuaState::RunCode() [C:\Users\User\Documents\Unreal Projects\UEPROJECT\Plugins\LuaMachine\Source\LuaMachine\Private\LuaState.cpp:396]
UnrealEditor_LuaMachine!ULuaState::RunFile() [C:\Users\User\Documents\Unreal Projects\UEPROJECT\Plugins\LuaMachine\Source\LuaMachine\Private\LuaState.cpp:364]
UnrealEditor_LuaMachine!ULuaBlueprintFunctionLibrary::LuaRunNonContentFile() [C:\Users\User\Documents\Unreal Projects\UEPROJECT\Plugins\LuaMachine\Source\LuaMachine\Private\LuaBlueprintFunctionLibrary.cpp:434]
UnrealEditor_LuaMachine!ULuaBlueprintFunctionLibrary::execLuaRunNonContentFile() [C:\Users\User\Documents\Unreal Projects\UEPROJECT\Plugins\LuaMachine\Intermediate\Build\Win64\UnrealEditor\Inc\LuaMachine\UHT\LuaBlueprintFunctionLibrary.gen.cpp:3491]
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll
Metadata
Metadata
Assignees
Labels
No labels