Skip to content

Commit 032d4af

Browse files
committed
Fix loading luau code starting with \t
1 parent c9099a4 commit 032d4af

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/ffi/luau/compat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ pub unsafe fn luaL_loadbufferx(
341341
fn free(p: *mut c_void);
342342
}
343343

344-
let chunk_is_text = size == 0 || (*data as u8) >= b'\n';
344+
let chunk_is_text = size == 0 || (*data as u8) >= b'\t';
345345
if !mode.is_null() {
346346
let modeb = CStr::from_ptr(mode).to_bytes();
347347
if !chunk_is_text && !modeb.contains(&b'b') {

tests/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn test_safety() -> Result<()> {
6969
fn test_load() -> Result<()> {
7070
let lua = Lua::new();
7171

72-
let func = lua.load("return 1+2").into_function()?;
72+
let func = lua.load("\treturn 1+2").into_function()?;
7373
let result: i32 = func.call(())?;
7474
assert_eq!(result, 3);
7575

0 commit comments

Comments
 (0)