Replies: 1 comment
-
It's quite easy to support (in mlua) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
UserData
means the targeting Rust native type could be modified by Lua scripts.However, there are situations one just knows the data should not be modified by any Lua script, if we have something like this:
then one could automatically derive ImmutableUserData to
Arc<T>
and save lots of redundant codes. We could move all the api that accept&T
as parameter intoImmutableUserData
, soUserData
could handleadd_field_method_get
like before.For example
Now we have to write code like this to let
Arc<Data>
have the same fields and method likeData
do, if we haveImmutableUserData
, this is accomplished automatically.Although I also know there may be other problems, I'm not a Lua expert, I may have wrong opinions.
Since Lua script is not controllable, one may try to modify the actual
ImmutableUserData
, and may cause undesirable issues? This is a concern for me.Beta Was this translation helpful? Give feedback.
All reactions