Embed lua within rust

I would like to embed lua within rust, like for example a user points the program at a lua program that configures things (similar to rc files) and passes the config to my rust program, like how neovim does it.

However, I'm not seeing how i can do this with the lua embedded libraries like lua (https://crates.io/crates/lua). Specifically, I'm tripping up own how my lua library would "talk" to my rust code. How would i do this?

You should have a look at rlua and mlua, both higher level than the plain lua crate

Ah, it seems that with mlua i can load a lua file, and call a function defined in the lua file and access the return value. Thanks for your help! (mlua also seems much more documented than lua, as it has examples as well.)

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.