Skip to content

Commit

Permalink
Lua: Add UStruct:find_property, UEVR_FProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 27, 2024
1 parent e350b95 commit 8cb9e68
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lua-api/lib/src/ScriptContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,15 @@ int ScriptContext::setup_bindings() {

return sol::make_object(s, f);
},
"find_property", [](sol::this_state s, uevr::API::UStruct& self, const std::wstring& name) {
auto p = self.find_property(name);

if (p == nullptr) {
return sol::make_object(s, sol::lua_nil);
}

return sol::make_object(s, p);
},
"get_child_properties", &uevr::API::UStruct::get_child_properties,
"get_properties_size", &uevr::API::UStruct::get_properties_size,
"get_children", &uevr::API::UStruct::get_children
Expand Down Expand Up @@ -766,6 +775,17 @@ int ScriptContext::setup_bindings() {
"get_class", &uevr::API::FField::get_class
);

m_lua.new_usertype<uevr::API::FProperty>("UEVR_FProperty",
sol::base_classes, sol::bases<uevr::API::FField>(),
"get_offset", &uevr::API::FProperty::get_offset,
"get_property_flags", &uevr::API::FProperty::get_property_flags,
"is_param", &uevr::API::FProperty::is_param,
"is_out_param", &uevr::API::FProperty::is_out_param,
"is_return_param", &uevr::API::FProperty::is_return_param,
"is_reference_param", &uevr::API::FProperty::is_reference_param,
"is_pod", &uevr::API::FProperty::is_pod
);

m_lua.new_usertype<uevr::API::FFieldClass>("UEVR_FFieldClass",
"get_fname", &uevr::API::FFieldClass::get_fname,
"get_name", &uevr::API::FFieldClass::get_name
Expand Down

0 comments on commit 8cb9e68

Please sign in to comment.