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;