Skip to content

Commit 763c2b2

Browse files
committed
Update repl example: don't print newline if no values returned
1 parent bafdb61 commit 763c2b2

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

examples/repl.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ fn main() {
2020
match lua.load(&line).eval::<MultiValue>() {
2121
Ok(values) => {
2222
editor.add_history_entry(line).unwrap();
23-
println!(
24-
"{}",
25-
values
26-
.iter()
27-
.map(|value| format!("{:#?}", value))
28-
.collect::<Vec<_>>()
29-
.join("\t")
30-
);
23+
if values.len() > 0 {
24+
println!(
25+
"{}",
26+
values
27+
.iter()
28+
.map(|value| format!("{:#?}", value))
29+
.collect::<Vec<_>>()
30+
.join("\t")
31+
);
32+
}
3133
break;
3234
}
3335
Err(Error::SyntaxError {

0 commit comments

Comments
 (0)