diff --git a/lua-api/lib/src/ScriptContext.cpp b/lua-api/lib/src/ScriptContext.cpp index 2df9496e..2eac1a9b 100644 --- a/lua-api/lib/src/ScriptContext.cpp +++ b/lua-api/lib/src/ScriptContext.cpp @@ -597,22 +597,11 @@ int ScriptContext::setup_bindings() { "read_byte", &lua::utility::read_t, "read_float", &lua::utility::read_t, "read_double", &lua::utility::read_t, - sol::meta_function::index, [](sol::this_state s, uevr::API::UObject* self, sol::object index_obj) -> sol::object { - if (!index_obj.is()) { - return sol::make_object(s, sol::lua_nil); - } - - const auto name = utility::widen(index_obj.as()); - - return lua::utility::prop_to_object(s, self, name); + sol::meta_function::index, [](sol::this_state s, uevr::API::UObject* self, const std::wstring& index_obj) -> sol::object { + return lua::utility::prop_to_object(s, self, index_obj); }, - sol::meta_function::new_index, [](sol::this_state s, uevr::API::UObject* self, sol::object index_obj, sol::object value) { - if (!index_obj.is()) { - return; - } - - const auto name = utility::widen(index_obj.as()); - lua::utility::set_property(s, self, name, value); + sol::meta_function::new_index, [](sol::this_state s, uevr::API::UObject* self, const std::wstring& index_obj, sol::object value) { + lua::utility::set_property(s, self, index_obj, value); } ); diff --git a/lua-api/lib/src/ScriptUtility.cpp b/lua-api/lib/src/ScriptUtility.cpp index 7ea8d553..d9fe353c 100644 --- a/lua-api/lib/src/ScriptUtility.cpp +++ b/lua-api/lib/src/ScriptUtility.cpp @@ -142,6 +142,8 @@ sol::object prop_to_object(sol::this_state s, void* self, uevr::API::FProperty* } return sol::make_object(s, *(uevr::API::UClass**)((uintptr_t)self + offset)); + case L"Function"_fnv: + return sol::make_object(s, (uevr::API::UFunction*)desc); // Not actually a property inside the object case L"StructProperty"_fnv: { const auto struct_data = (void*)((uintptr_t)self + offset);