-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Use serializable structs as input to call method? #143
Comments
Ok I'm answering my own question. Time gave me open mindedness. This was something I kind of realised already but with new information, it got fuzzy in my head. I explain it here for myself and anybody else that could be interested. So to interact in lua, you've got 2 ways (back and forth). Either:
Ok so now there is a bit more. When you expose a function using with
Now, popup.call(popup_opts)?; Now I'm still a troubled man you see. Both About the answer of my question more specifically, this works nicely and it makes me think that my questions are probably not worth it: impl<'lua> IntoLua<'lua> for PopupOpts {
fn into_lua(self, lua: &'lua Lua) -> LuaResult<LuaValue<'lua>> {
lua.to_value(&self)
}
} |
As you noted, both our traits and the ones exposed by
If I understand you correctly you'd like to have something like this: #[cfg(feature = "mlua")]
mod mlua_impls {
impl<T: ToObject> IntoLua for T { .. }
impl<T: FromObject> FromLua for T { .. }
} unfortunately this results in a compiler error because of the orphan rule. |
Yes, it would be something like this but I don't know what would be the right way to do it. And what about the other way around? Not sure it makes sense again #[cfg(feature = "mlua")]
mod mlua_impls {
impl<T: IntoLua> ToObject for T { .. }
impl<T: FromLua> FromObject for T { .. }
} |
We'd need specialization for that to work. |
Hello, I'm trying to use
nui
plugin to create a popup window. I'm not sure about the way to do it.I checked the
mechanic
example but it seems that it's not how I should use it.I checked:
I have hard times connecting the dots. I may need to implement
FromLua
but I'm not sure.I would like to get the
Popup
table from lua and call withPopupOpts
as arguments.The text was updated successfully, but these errors were encountered: