Skip to content

Commit

Permalink
Merge 8a0a43b into d3096d9
Browse files Browse the repository at this point in the history
  • Loading branch information
localcc authored Jan 17, 2025
2 parents d3096d9 + 8a0a43b commit d34e9b8
Show file tree
Hide file tree
Showing 10 changed files with 650 additions and 1 deletion.
79 changes: 79 additions & 0 deletions UE4SS/include/LuaType/LuaTMap.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#pragma once

#include <LuaType/LuaUObject.hpp>

#include <Unreal/Core/UObject/UObjectHierarchyFwd.hpp>

namespace RC::Unreal
{

}

namespace RC::LuaType
{
struct TMapName
{
constexpr static const char* ToString()
{
return "TMap";
}
};

class TMap : public RemoteObjectBase<Unreal::FScriptMap, TMapName>
{
private:
Unreal::UObject* m_base;

Unreal::FMapProperty* m_property;
Unreal::FProperty* m_key_property;
Unreal::FProperty* m_value_property;

private:
explicit TMap(const PusherParams&);

public:
TMap() = delete;

auto static construct(const PusherParams&) -> const LuaMadeSimple::Lua::Table;
auto static construct(const LuaMadeSimple::Lua&, BaseObject&) -> const LuaMadeSimple::Lua::Table;

private:
auto static setup_metamethods(BaseObject&) -> void;

private:
template <LuaMadeSimple::Type::IsFinal is_final>
auto static setup_member_functions(const LuaMadeSimple::Lua::Table&) -> void;

enum class MapOperation
{
Find,
Add,
Contains,
Remove,
Empty,
};

auto static prepare_to_handle(MapOperation, const LuaMadeSimple::Lua&) -> void;
};

struct FScriptMapInfo
{
Unreal::FProperty* key{};
Unreal::FProperty* value{};

Unreal::FName key_fname{};
Unreal::FName value_fname{};

Unreal::FScriptMapLayout layout{};

FScriptMapInfo(Unreal::FProperty* key, Unreal::FProperty* value);

/**
* Validates existence of lua pushers for this key/values in this structure.
* Throws if a pusher for a key/value was not found
*
* @param lua Lua state to throw against.
*/
void validate_pushers(const LuaMadeSimple::Lua& lua);
};
}
1 change: 1 addition & 0 deletions UE4SS/include/LuaType/LuaUObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ namespace RC::LuaType
RC_UE4SS_API auto push_uint64property(const PusherParams&) -> void;
RC_UE4SS_API auto push_structproperty(const PusherParams&) -> void;
RC_UE4SS_API auto push_arrayproperty(const PusherParams&) -> void;
RC_UE4SS_API auto push_mapproperty(const PusherParams&) -> void;
RC_UE4SS_API auto push_floatproperty(const PusherParams&) -> void;
RC_UE4SS_API auto push_doubleproperty(const PusherParams&) -> void;
RC_UE4SS_API auto push_boolproperty(const PusherParams&) -> void;
Expand Down
Loading

0 comments on commit d34e9b8

Please sign in to comment.