Macro ezlua::impl_tolua_as_serde
source · macro_rules! impl_tolua_as_serde { ($t:ty) => { ... }; }
Expand description
Helper macro to impl ToLua for serializable types easily
use elua::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Debug, Default, Deserialize, Serialize)]
struct Config {
name: String,
path: String,
timeout: u64,
// ...
}
ezlua::impl_tolua_as_serde!(Config);
let lua = Lua::with_open_libs();
lua.global().set("config", Config::default())?;
// config in lua is `{name = '', path = '', timeout = 0}`