From 6df96d8eb1eda2dd3df541d999db4c83734abec3 Mon Sep 17 00:00:00 2001 From: kyren Date: Wed, 19 Jul 2017 20:15:46 -0400 Subject: [PATCH] Rename LightUserData to LuaLightUserData for consistency I know, this is the opposite of PR #17 wishes to do, please don't take this as an indication that I would wish to do the opposite. I actually want to discuss PR #17 with you, but I'm not sure about it yet, and my pedantry will not allow me to let this remain inconsistent in the meantime. This way, either way it's consistent haha. --- src/conversion.rs | 4 ++-- src/lua.rs | 6 +++--- src/tests.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/conversion.rs b/src/conversion.rs index 7a65597..a27ff25 100644 --- a/src/conversion.rs +++ b/src/conversion.rs @@ -148,13 +148,13 @@ impl<'lua> FromLua<'lua> for bool { } } -impl<'lua> ToLua<'lua> for LightUserData { +impl<'lua> ToLua<'lua> for LuaLightUserData { fn to_lua(self, _: &'lua Lua) -> LuaResult> { Ok(LuaValue::LightUserData(self)) } } -impl<'lua> FromLua<'lua> for LightUserData { +impl<'lua> FromLua<'lua> for LuaLightUserData { fn from_lua(v: LuaValue, _: &'lua Lua) -> LuaResult { match v { LuaValue::LightUserData(ud) => Ok(ud), diff --git a/src/lua.rs b/src/lua.rs index 6272cc1..3c1c5c8 100644 --- a/src/lua.rs +++ b/src/lua.rs @@ -23,7 +23,7 @@ pub enum LuaValue<'lua> { /// The Lua value `true` or `false`. Boolean(bool), /// A "light userdata" object, equivalent to a raw pointer. - LightUserData(LightUserData), + LightUserData(LuaLightUserData), /// An integer number. /// /// Any Lua number convertible to a `LuaInteger` will be represented as this variant. @@ -164,7 +164,7 @@ pub type LuaNumber = ffi::lua_Number; /// A "light" userdata value. Equivalent to an unmanaged raw pointer. #[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub struct LightUserData(pub *mut c_void); +pub struct LuaLightUserData(pub *mut c_void); /// Handle to an internal Lua string. /// @@ -1427,7 +1427,7 @@ impl Lua { } ffi::LUA_TLIGHTUSERDATA => { - let ud = LuaValue::LightUserData(LightUserData(ffi::lua_touserdata(state, -1))); + let ud = LuaValue::LightUserData(LuaLightUserData(ffi::lua_touserdata(state, -1))); ffi::lua_pop(state, 1); ud } diff --git a/src/tests.rs b/src/tests.rs index 0dcfb67..7ca50e7 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -707,9 +707,9 @@ fn test_lightuserdata() { let res = globals .get::<_, LuaFunction>("id") .unwrap() - .call::<_, LightUserData>(LightUserData(42 as *mut c_void)) + .call::<_, LuaLightUserData>(LuaLightUserData(42 as *mut c_void)) .unwrap(); - assert_eq!(res, LightUserData(42 as *mut c_void)); + assert_eq!(res, LuaLightUserData(42 as *mut c_void)); } #[test]