lua-macro 0.1.1

Embed Lua code directly into your Rust, for some reason
1
2
3
4
5
6
7
8
9
10
use mlua::prelude::*;

#[allow(dead_code)]
pub fn run_lua<'a, R>(code: &str) -> R
    where R: for<'local> FromLuaMulti<'local> + Clone
{
    let lua = Lua::new();
    let res: Result<R, _> = lua.load(code).eval();
    res.unwrap().clone()
}