You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've run into a situation where I have an OwnedFunction stored somewhere in Rust, which is later called as a callback from Rust.
To protect the function call, I'd like to install a hook (via lua.set_hook) when calling the Lua function. But for a hook, I need access to the function's lua instance.
Of course the function has access to its lua instance, otherwise it could not call itself. But there's no public (outside the mlua crate) access to this function's lua instance. Probably for a good reason, but then again, maybe getting a temp ref for the function's Lua instance could be safe?
Or is there some other way to install a hook when all you have is an OwnedFunction that I'm missing?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've run into a situation where I have an OwnedFunction stored somewhere in Rust, which is later called as a callback from Rust.
To protect the function call, I'd like to install a hook (via lua.set_hook) when calling the Lua function. But for a hook, I need access to the function's lua instance.
Of course the function has access to its lua instance, otherwise it could not call itself. But there's no public (outside the mlua crate) access to this function's lua instance. Probably for a good reason, but then again, maybe getting a temp ref for the function's Lua instance could be safe?
Or is there some other way to install a hook when all you have is an OwnedFunction that I'm missing?
Beta Was this translation helpful? Give feedback.
All reactions