Skip to content

Implement Typed for UserDataRef(Mut)#31

Merged
Tired-Fox merged 1 commit into
Tired-Fox:mainfrom
selaux:typed-user-data-ref
May 1, 2026
Merged

Implement Typed for UserDataRef(Mut)#31
Tired-Fox merged 1 commit into
Tired-Fox:mainfrom
selaux:typed-user-data-ref

Conversation

@selaux
Copy link
Copy Markdown
Contributor

@selaux selaux commented Apr 24, 2026

Not sure if that was intentionally omitted, but Typed should probably also be implemented for UserDataRef and UserDataRefMut. You can pass references to user data to a function by using those. This adds the two implementations.

Comment thread src/typed/mod.rs Outdated
Comment thread src/typed/mod.rs Outdated
@Tired-Fox
Copy link
Copy Markdown
Owner

@selaux

Can you also add tests into type_file_tests.rs and luau_type_file_tests.rs to prove that the output is as expected. Can be something like a function type that takes these types as parameters and the output would be ---@param param0 string or something similar with the function signature.

@selaux selaux force-pushed the typed-user-data-ref branch 3 times, most recently from e64ec6a to 50f0393 Compare April 27, 2026 19:53
@selaux selaux force-pushed the typed-user-data-ref branch from 50f0393 to 3e6d837 Compare April 28, 2026 18:15
@selaux
Copy link
Copy Markdown
Contributor Author

selaux commented Apr 28, 2026

I think I got everything now. The tests are a bit more extensive than requested, because to test the UserDataRef<T> I had to construct a type T that already implements UserData and Typed, so I decided to also implement TypedUserData for the functions. In the end I ended up testing all of the functionality of TypedUserData where the functions / methods take UserDataRef and UserDataRefMut.

@Tired-Fox
Copy link
Copy Markdown
Owner

I think I would rather have it be detailed enough to make sure everything works as expected. I will review it again and try to get it in sometime today.

@Tired-Fox Tired-Fox merged commit 361f979 into Tired-Fox:main May 1, 2026
15 checks passed
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