Replies: 1 comment
-
|
You can take a look to a userdata example: https://github.com/mlua-rs/mlua/blob/main/examples/userdata.rs
I don't think this approach would work well. I would recommend returning userdata with automatically registered methods/fields/functions. |
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
I must admit I'm quite new to both Rust and mlua. I'm familiar with C/C++ and read the Rust documentation book up to chapter 7. After deciding that I should just get my toes wet.
I've started my first project - a Lua module port of
wasmtime, with the eventual goal of writing a loader to integrate WASM modules with lua. I could skip a bunch of steps here by writing the loader entirely in Rust, but I was hoping to port the wasmtime API so I could provide a WebAssembly API in Lua similar to JavaScript. However, I'm getting very stuck with the (absurdly underdocumented IMO)UserDataandFromLuatraits.Here's my naive approach to get the
wasmtime::Enginestruct to be accessible from the Lua side.Compiling causes a build error -
wasmtime::Enginedoes not implementstd::marker::Copy. I'm sort of lost at this point. I needLuaEngineto implementFromLuabecause ofwasmtime::Module::from_file(engine: &Engine, path: String)(and its eventual Lua counterpart).How can I get around this restriction? I want a
LuaEngineinstance to essentially be a reference to awasmtime::Engine.Beta Was this translation helpful? Give feedback.
All reactions