diff --git a/src/type_generator.rs b/src/type_generator.rs index e9d2470..e5d1644 100644 --- a/src/type_generator.rs +++ b/src/type_generator.rs @@ -49,7 +49,9 @@ impl Deref for NameContainer { #[cfg(feature = "rlua")] impl<'lua> FromLuaR<'lua> for NameContainer { fn from_lua(lua_value: rlua::Value<'lua>, lua: Context<'lua>) -> ResultR { - Ok(String::from_lua(lua_value, lua)?.into_bytes().into()) + Ok(::from_lua(lua_value, lua)? + .into_bytes() + .into()) } } #[cfg(feature = "rlua")] @@ -68,7 +70,9 @@ impl ToTypename for NameContainer { #[cfg(feature = "mlua")] impl<'lua> FromLuaM<'lua> for NameContainer { fn from_lua(lua_value: mlua::Value<'lua>, lua: &'lua Lua) -> ResultM { - Ok(String::from_lua(lua_value, lua)?.into_bytes().into()) + Ok(::from_lua(lua_value, lua)? + .into_bytes() + .into()) } } #[cfg(feature = "mlua")] diff --git a/src/type_representation.rs b/src/type_representation.rs index b7bd755..5d72545 100644 --- a/src/type_representation.rs +++ b/src/type_representation.rs @@ -286,17 +286,26 @@ impl_type_name_life_time!("any" rlua::Value<'lua>); impl_type_name_life_time!("any" mlua::Value<'lua>); #[cfg(feature = "rlua")] -use rlua::{Table, Value}; +use rlua::{Table as TableR, Value as ValueR}; #[cfg(feature = "mlua")] -use mlua::{Table, Value}; +use mlua::{Table as TableM, Value as ValueM}; -#[cfg(any(feature = "mlua", feature = "rlua"))] -impl<'lua> ToTypename for Table<'lua> { +#[cfg(feature = "rlua")] +impl<'lua> ToTypename for TableR<'lua> { + fn to_typename() -> Type { + Type::Map(crate::MapRepresentation { + key: ValueR::to_typename().into(), + value: ValueR::to_typename().into(), + }) + } +} +#[cfg(feature = "mlua")] +impl<'lua> ToTypename for TableM<'lua> { fn to_typename() -> Type { Type::Map(crate::MapRepresentation { - key: Value::to_typename().into(), - value: Value::to_typename().into(), + key: ValueM::to_typename().into(), + value: ValueM::to_typename().into(), }) } } @@ -308,12 +317,24 @@ impl_type_name_life_time!("string" rlua::String<'lua>); impl_type_name_life_time!("string" mlua::String<'lua>); #[cfg(feature = "mlua")] -use mlua::Function; +use mlua::Function as FunctionM; #[cfg(feature = "rlua")] -use rlua::Function; +use rlua::Function as FunctionR; -#[cfg(any(feature = "mlua", feature = "rlua"))] -impl<'lua> ToTypename for Function<'lua> { +#[cfg(feature = "rlua")] +impl<'lua> ToTypename for FunctionR<'lua> { + fn to_typename() -> Type { + Type::Function(crate::FunctionRepresentation { + params: vec![FunctionParam { + param_name: Some("...".into()), + ty: Type::new_single("any", KindOfType::Builtin), + }], + returns: vec![Type::new_single("any...", KindOfType::Builtin)], + }) + } +} +#[cfg(feature = "mlua")] +impl<'lua> ToTypename for FunctionM<'lua> { fn to_typename() -> Type { Type::Function(crate::FunctionRepresentation { params: vec![FunctionParam { diff --git a/src/type_walker.rs b/src/type_walker.rs index 685d93f..4d7b3e1 100644 --- a/src/type_walker.rs +++ b/src/type_walker.rs @@ -294,7 +294,7 @@ impl TypeWalker { } } -#[cfg(feature = "rlua")] +#[cfg(all(feature = "rlua", not(feature = "mlua")))] impl TypeWalker { ///collect every instance that is getting shared with lua pub fn document_global_instance(