diff --git a/lua-api/lib/src/ScriptContext.cpp b/lua-api/lib/src/ScriptContext.cpp index b156fc39..57d4b9b1 100644 --- a/lua-api/lib/src/ScriptContext.cpp +++ b/lua-api/lib/src/ScriptContext.cpp @@ -504,6 +504,39 @@ sol::object call_function(sol::this_state s, uevr::API::UObject* self, uevr::API *(uevr::API::UClass**)¶ms[offset] = arg; continue; } + case L"StructProperty"_fnv: + { + const auto arg_obj = args[args_index++]; + const auto struct_desc = ((uevr::API::FStructProperty*)prop_desc)->get_struct(); + + if (struct_desc == nullptr) { + throw sol::error("Struct property has no struct"); + } + + if (struct_desc == get_vector_struct()) { + if (arg_obj.is()) { + const auto arg = arg_obj.as(); + + if (is_ue5()) { + *(lua::datatypes::Vector3d*)¶ms[offset] = arg; + } else { + *(lua::datatypes::Vector3f*)¶ms[offset] = arg; + } + } else if (arg_obj.is()) { + const auto arg = arg_obj.as(); + + if (is_ue5()) { + *(lua::datatypes::Vector3d*)¶ms[offset] = arg; + } else { + *(lua::datatypes::Vector3f*)¶ms[offset] = arg; + } + } else { + throw sol::error("Invalid argument type for FVector"); + } + } + + continue; + } case L"ArrayProperty"_fnv: // TODO throw sol::error("Array properties are not supported (yet)");