Skip to content

updating to 0.10 #528

Answered by khvzak
brentp asked this question in Q&A
Feb 13, 2025 · 3 comments · 7 replies
Discussion options

You must be logged in to vote

Is there a problem with using impl mlua::UserData and lua.register_userdata_type?

If you can implement UserData for your type, why would you need register_userdata_type ? You can add all methods to impl UserData.
You can redefine the same fn register method in UserData to manipulate UserDataRegistry

register_userdata_type was built for the case when you cannot implement UserData on foreign object because of Rust orphan rule.

Replies: 3 comments 7 replies

Comment options

You must be logged in to vote
5 replies
@brentp
Comment options

@brentp
Comment options

@brentp
Comment options

@khvzak
Comment options

Answer selected by brentp
@brentp
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@khvzak
Comment options

@brentp
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants