From 31fa9173ae67628df7b7eaad4610263220d3a2f6 Mon Sep 17 00:00:00 2001 From: kyren Date: Wed, 2 May 2018 20:05:43 -0400 Subject: [PATCH] Fix #78 --- examples/guided_tour.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/guided_tour.rs b/examples/guided_tour.rs index 2594f9d..85cecda 100644 --- a/examples/guided_tour.rs +++ b/examples/guided_tour.rs @@ -142,7 +142,10 @@ fn guided_tour() -> Result<()> { let vec2_constructor = lua.create_function(|_, (x, y): (f32, f32)| Ok(Vec2(x, y)))?; globals.set("vec2", vec2_constructor)?; - assert!(lua.eval::("(vec2(1, 2) + vec2(2, 2)):magnitude()", None)? - 5.0 < f32::EPSILON); + assert!( + (lua.eval::("(vec2(1, 2) + vec2(2, 2)):magnitude()", None)? - 5.0).abs() + < f32::EPSILON + ); // Normally, Rust types passed to `Lua` must be `Send`, because `Lua` itself is `Send`, and must // be `'static`, because there is no way to tell when Lua might garbage collect them. There is,