Expand description
FromLua / IntoLua — bidirectional conversion between Rust types and LuaValue.
These traits allow Lua function arguments and return values to be expressed
with native Rust types instead of manually calling get_arg / push_value.
§Built-in impls
(),bool,i8..i64,u8..u64,f32,f64String,&str(via intermediateString)Option<T>whereT: FromLua/T: IntoLuaLuaValue(identity — zero-cost passthrough)
§Usage in derive macros
The #[lua_methods] macro generates calls to FromLua::from_lua for each
parameter and IntoLua::into_lua for the return value, keeping the codegen
type-agnostic and user-extensible.
§User extensibility
Users can implement FromLua / IntoLua for their own types:
ⓘ
impl FromLua for MyVec3 {
fn from_lua(value: LuaValue, state: &LuaState) -> Result<Self, String> {
// extract from userdata or table
}
}