Skip to content

Conversation

@Corporalwill123
Copy link
Contributor

@Corporalwill123 Corporalwill123 commented Jan 20, 2026

Description

UFunction was only inheriting from UObject instead of from UStruct, so now it does. UClass is slightly different, since instead of constructing from UStruct, it setup the member functions directly, so I updated it to be more consistent.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

Using this script that is supposed to find any classes or functions that use a given struct and print them to the console.

function RecursivePropertyFindStruct(property, scriptStruct)
   if (not scriptStruct:IsValid()) then print("ScriptStruct invalid") end
   if (property:IsA(PropertyTypes.ArrayProperty)) then
      return RecursivePropertyFindStruct(property:GetInner(), scriptStruct)
   elseif (property:IsA(PropertyTypes.StructProperty)) then
      if (property:GetStruct():GetAddress() == scriptStruct:GetAddress()) then
         return true
      end
      local found = false
      property:GetStruct():ForEachProperty( function(innerProperty)
         if (RecursivePropertyFindStruct(innerProperty, scriptStruct)) then
            found = true
            return true
         end
      end)
      return found
   end
   return false
end

RegisterKeyBind(Key.O, function()
   ExecuteInGameThread( function()
      local searchingStruct = StaticFindObject("/Path/To.Struct") -- give the path to the struct here
      if (not searchingStruct:IsValid()) then print("Couldn't find struct") return end
      local foundObjects = {}
      ForEachUObject( function (object)
         if (not object:IsValid() or not (object:IsClass() or object:IsA("/Script/CoreUObject.Function"))) then return end
         object:ForEachProperty(function(property)
            if (RecursivePropertyFindStruct(property, searchingStruct)) then
               table.insert(foundObjects,object)
               return true
            end
         end)
      end)
      print("found " .. #foundObjects .. " objects that use " .. searchingStruct:GetFullName())
      for _, object in ipairs(foundObjects) do
         print(object:GetFullName())
      end
   end)
end)

Checklist

  • I have made corresponding changes to the documentation.
  • I have added the necessary description of this PR to the changelog, and I have followed the same format as other entries.

@Corporalwill123 Corporalwill123 force-pushed the LuaUFuncUClassInheritance branch from 4c08b38 to d155d07 Compare January 20, 2026 14:34
Mostly affects UFunction, as UClass had already directly inherited the member functions

now possible to iterate over function properties in Lua
@Corporalwill123 Corporalwill123 force-pushed the LuaUFuncUClassInheritance branch from d155d07 to 6f0aa77 Compare January 20, 2026 14:46
@UE4SS UE4SS merged commit dd64245 into UE4SS-RE:main Jan 26, 2026
@Corporalwill123 Corporalwill123 deleted the LuaUFuncUClassInheritance branch January 26, 2026 21:48
UE4SS added a commit to Corporalwill123/RE-UE4SS that referenced this pull request Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants