From 54beb8f50df1eb759db2e90774a30b49969a3031 Mon Sep 17 00:00:00 2001 From: xiao fan Date: Fri, 18 Aug 2023 11:42:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:UE.Array(0)=E5=8F=98=E9=87=8F=E4=B8=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0math.maxvalue,c++=E5=B1=82=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=88=B0=E7=9A=84=E5=80=BC=E4=B8=BA=20int32.maxvalue,=20?= =?UTF-8?q?=E4=BD=BF=E7=94=A8int64=E7=B1=BB=E5=9E=8B=E6=9D=A5=E6=98=A0?= =?UTF-8?q?=E5=B0=84lua=E4=B8=AD=E7=9A=84integer=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Private/Registries/PropertyRegistry.cpp | 29 ++++++++++++++++++- .../Private/Registries/PropertyRegistry.h | 2 ++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Plugins/UnLua/Source/UnLua/Private/Registries/PropertyRegistry.cpp b/Plugins/UnLua/Source/UnLua/Private/Registries/PropertyRegistry.cpp index 57a76673..9eab1de3 100644 --- a/Plugins/UnLua/Source/UnLua/Private/Registries/PropertyRegistry.cpp +++ b/Plugins/UnLua/Source/UnLua/Private/Registries/PropertyRegistry.cpp @@ -32,7 +32,7 @@ namespace UnLua TypeInterface = GetBoolProperty(); break; case LUA_TNUMBER: - TypeInterface = lua_isinteger(L, Index) > 0 ? GetIntProperty() : GetFloatProperty(); + TypeInterface = lua_isinteger(L, Index) > 0 ? GetInt64Property() : GetFloatProperty(); break; case LUA_TSTRING: TypeInterface = GetStringProperty(); @@ -144,6 +144,33 @@ namespace UnLua } return IntProperty; } + + TSharedPtr FPropertyRegistry::GetInt64Property() + { + if (!Int64Property) + { +#if UE_VERSION_OLDER_THAN(5, 1, 0) + const auto Property = new FInt64Property(PropertyCollector, NAME_None, RF_Transient, 0, CPF_HasGetValueTypeHash); +#else + constexpr auto Params = UECodeGen_Private::FInt64PropertyParams + { + nullptr, + nullptr, + CPF_HasGetValueTypeHash, + UECodeGen_Private::EPropertyGenFlags::Int64, + RF_Transient, + 1, + nullptr, + nullptr, + 0, + METADATA_PARAMS(nullptr, 0) + }; + const auto Property = new FInt64Property(PropertyCollector, Params); +#endif + Int64Property = TSharedPtr(FPropertyDesc::Create(Property)); + } + return Int64Property; + } TSharedPtr FPropertyRegistry::GetFloatProperty() { diff --git a/Plugins/UnLua/Source/UnLua/Private/Registries/PropertyRegistry.h b/Plugins/UnLua/Source/UnLua/Private/Registries/PropertyRegistry.h index d7dfc932..6c805a1d 100644 --- a/Plugins/UnLua/Source/UnLua/Private/Registries/PropertyRegistry.h +++ b/Plugins/UnLua/Source/UnLua/Private/Registries/PropertyRegistry.h @@ -42,6 +42,7 @@ namespace UnLua private: TSharedPtr GetBoolProperty(); TSharedPtr GetIntProperty(); + TSharedPtr GetInt64Property(); TSharedPtr GetFloatProperty(); TSharedPtr GetStringProperty(); TSharedPtr GetNameProperty(); @@ -53,6 +54,7 @@ namespace UnLua TMap> FieldProperties; TSharedPtr BoolProperty; TSharedPtr IntProperty; + TSharedPtr Int64Property; TSharedPtr FloatProperty; TSharedPtr StringProperty; TSharedPtr NameProperty;