Skip to content

Commit 31fa917

Browse files
committed
1 parent 71f3dd5 commit 31fa917

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/guided_tour.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ fn guided_tour() -> Result<()> {
142142
let vec2_constructor = lua.create_function(|_, (x, y): (f32, f32)| Ok(Vec2(x, y)))?;
143143
globals.set("vec2", vec2_constructor)?;
144144

145-
assert!(lua.eval::<f32>("(vec2(1, 2) + vec2(2, 2)):magnitude()", None)? - 5.0 < f32::EPSILON);
145+
assert!(
146+
(lua.eval::<f32>("(vec2(1, 2) + vec2(2, 2)):magnitude()", None)? - 5.0).abs()
147+
< f32::EPSILON
148+
);
146149

147150
// Normally, Rust types passed to `Lua` must be `Send`, because `Lua` itself is `Send`, and must
148151
// be `'static`, because there is no way to tell when Lua might garbage collect them. There is,

0 commit comments

Comments
 (0)