Skip to content

Commit 3b558a0

Browse files
committed
Fix loading Luau chunks starting with \t
1 parent 135d44b commit 3b558a0

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/chunk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ impl Chunk<'_> {
758758
return ChunkMode::Binary;
759759
}
760760
#[cfg(feature = "luau")]
761-
if *source.first().unwrap_or(&u8::MAX) < b'\n' {
761+
if *source.first().unwrap_or(&u8::MAX) < b'\t' {
762762
return ChunkMode::Binary;
763763
}
764764
}

tests/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ fn test_exec() -> Result<()> {
132132
fn test_eval() -> Result<()> {
133133
let lua = Lua::new();
134134

135-
assert_eq!(lua.load("1 + 1").eval::<i32>()?, 2);
135+
assert_eq!(lua.load("\t1 + 1").eval::<i32>()?, 2);
136136
assert_eq!(lua.load("false == false").eval::<bool>()?, true);
137-
assert_eq!(lua.load("return 1 + 2").eval::<i32>()?, 3);
137+
assert_eq!(lua.load("\nreturn 1 + 2").eval::<i32>()?, 3);
138138
match lua.load("if true then").eval::<()>() {
139139
Err(Error::SyntaxError {
140140
incomplete_input: true,

0 commit comments

Comments
 (0)