Skip to content

feat(lua): adds support for FSetProperty in Lua scripting#883

Merged
narknon merged 3 commits intomainfrom
LuaTSetSupport
Sep 3, 2025
Merged

feat(lua): adds support for FSetProperty in Lua scripting#883
narknon merged 3 commits intomainfrom
LuaTSetSupport

Conversation

@narknon
Copy link
Copy Markdown
Collaborator

@narknon narknon commented May 20, 2025

Description
Adds Lua bindings for FSetProperty, allowing access to Unreal Engine sets from Lua scripts.

This includes:

  • Adding FScriptSetLayout to the list of valid UDT names in UVTD dumps.
  • Updating member variable layout templates for various engine versions to include SetLayout offset.
  • Adding Lua type definitions and functions for TSet.
  • Adding a pusher for SetProperty to the Lua state.

Fixes # (issue) (if applicable)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Is/requires documentation update

How has this been tested?

Tested via the following lua script. This test will only work on UE versions after the ConcurrencySet property was added (I believe sometime after 4.26), and would need to be modified for other versions.
TSetTest.zip

Checklist

  • I have commented my code, particularly in hard-to-understand areas.
  • 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.
  • Any dependent changes have been merged and published in downstream modules.
    • Requires Re-UE4SS/UEPseudo#129

Copy link
Copy Markdown
Collaborator

@UE4SS UE4SS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify where SetLayout in FSetProperty came from ?
It wasn't there before obviously, and this PR doesn't seem to change UVTD to add it.
Was this method previously manually deleted from files before being pushed to the repo or something ?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2025

MSVC-Game__Shipping__Win64 Download Logs
Build Details
Name Information
PR Commit c93966a
Merge Commit b7b5672
Size 29.44 MB
Last Updated Sep 3, 25, 1:06:09 AM UTC
Expires At Sep 17, 25, 1:06:07 AM UTC

MSVC-Game__Debug__Win64 Download Logs
Build Details
Name Information
PR Commit c93966a
Merge Commit b7b5672
Size 46.64 MB
Last Updated Sep 3, 25, 1:06:28 AM UTC
Expires At Sep 17, 25, 1:06:23 AM UTC

@narknon
Copy link
Copy Markdown
Collaborator Author

narknon commented May 21, 2025

Can you clarify where SetLayout in FSetProperty came from ? It wasn't there before obviously, and this PR doesn't seem to change UVTD to add it. Was this method previously manually deleted from files before being pushed to the repo or something ?

assets/Default_UVTD_Configs/Config/valid_udt_names.json

@UE4SS
Copy link
Copy Markdown
Collaborator

UE4SS commented May 21, 2025

Can you clarify where SetLayout in FSetProperty came from ? It wasn't there before obviously, and this PR doesn't seem to change UVTD to add it. Was this method previously manually deleted from files before being pushed to the repo or something ?

assets/Default_UVTD_Configs/Config/valid_udt_names.json

This PR only adds FScriptSetLayout to that file.
It already had FSetProperty, but that doesn't explain why FSetProperty::SetLayout is magically appearing now.

@narknon
Copy link
Copy Markdown
Collaborator Author

narknon commented May 21, 2025

This PR only adds FScriptSetLayout to that file. It already had FSetProperty, but that doesn't explain why FSetProperty::SetLayout is magically appearing now.

Because that is the return type so it wasn't dumped as a valid udt type prior.

@narknon
Copy link
Copy Markdown
Collaborator Author

narknon commented May 21, 2025

This PR only adds FScriptSetLayout to that file. It already had FSetProperty, but that doesn't explain why FSetProperty::SetLayout is magically appearing now.

Because that is the return type so it wasn't dumped as a valid udt type prior.

UVTD is quite confusing. I should get back to my refactor.

@narknon narknon force-pushed the LuaTSetSupport branch 2 times, most recently from 75d7c38 to 7a244b2 Compare May 28, 2025 17:15
@Lyrth
Copy link
Copy Markdown
Contributor

Lyrth commented Jun 5, 2025

Tested, changes look good to me.

Should remember to also update Types.lua

@narknon
Copy link
Copy Markdown
Collaborator Author

narknon commented Jun 5, 2025

Could you make an issue for the TArray thing you mentioned?

@Lyrth
Copy link
Copy Markdown
Contributor

Lyrth commented Jun 10, 2025

Could you make an issue for the TArray thing you mentioned?

It appears that the issue involves a wider scope than just TArray, should probably be decided at a later time instead.

@narknon
Copy link
Copy Markdown
Collaborator Author

narknon commented Jun 11, 2025

It appears that the issue involves a wider scope than just TArray, should probably be decided at a later time instead.

An issue for the aspects we discussed about table with member vs not, etc. would still be helpful for tracking.

@Lyrth
Copy link
Copy Markdown
Contributor

Lyrth commented Jun 13, 2025

An issue for the aspects we discussed about table with member vs not, etc. would still be helpful for tracking.

Done

@narknon narknon force-pushed the LuaTSetSupport branch 3 times, most recently from 2ae5db7 to be13f64 Compare September 3, 2025 00:39
narknon and others added 3 commits September 2, 2025 20:48
Adds Lua bindings for `FSetProperty`, allowing access to Unreal Engine sets from Lua scripts.

This includes:
- Adding `FScriptSetLayout` to the list of valid UDT names.
- Updating member variable layout templates for various engine versions to include `SetLayout` offset.
- Adding Lua type definitions and functions for `TSet`.
- Adding a pusher for `SetProperty` to the Lua state.
  - Fix array-like table value extraction using insert_value(-2)
  - Add TSet userdata support in lua_to_memory for round-trip functionality
  - Fix stack management in for_each_in_table iteration
  - Resolve string and FName type conversion errors
  - Fixes array interpretation to use values (10,11,12) instead of indices (1,2,3)
  - Enables passing TSet properties as function parameters

NOTE: For now, TSet support is being merged with the same outparam functionality as TArray. TMap will be updated to match the TArray functionality with a pragma to control using the legacy behavior.
@narknon narknon merged commit 205d3bc into main Sep 3, 2025
13 checks passed
@narknon narknon deleted the LuaTSetSupport branch September 3, 2025 01:07
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.

3 participants