Skip to content

Commit 3044dae

Browse files
committed
WIP portability
1 parent 5bddac9 commit 3044dae

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/function.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ pub struct FunctionInfo {
5151
/// The line number where the definition of the function ends (not set by Luau).
5252
pub last_line_defined: Option<usize>,
5353
/// Number of function parameters
54-
#[cfg(any(not(feature = "lua51"), doc))]
54+
#[cfg(any(not(any(feature = "lua51", feature="luajit"), doc))]
5555
pub num_params: usize,
5656
/// True if function accepts variable args
57-
#[cfg(any(not(feature = "lua51"), doc))]
57+
#[cfg(any(not(any(feature = "lua51", feature="luajit"), doc))]
5858
pub is_vararg: bool,
5959
/// Number of upvalues
60+
#[cfg(any(not(feature = "luau"), doc))]
6061
pub nups: usize,
6162
}
6263

@@ -363,7 +364,7 @@ impl Function {
363364

364365
let mut ar: ffi::lua_Debug = mem::zeroed();
365366
lua.push_ref(&self.0);
366-
#[cfg(not(feature = "luau"))] // TODO: cfg for u
367+
#[cfg(not(feature = "luau"))]
367368
let res = ffi::lua_getinfo(state, cstr!(">Snu"), &mut ar);
368369
#[cfg(feature = "luau")]
369370
let res = ffi::lua_getinfo(state, -1, cstr!("sn"), &mut ar);
@@ -389,10 +390,11 @@ impl Function {
389390
last_line_defined: linenumber_to_usize(ar.lastlinedefined),
390391
#[cfg(feature = "luau")]
391392
last_line_defined: None,
392-
#[cfg(not(feature = "lua51"))]
393+
#[cfg(not(any(feature = "lua51", feature="luajit"))]
393394
num_params: ar.nparams as _,
394-
#[cfg(not(feature = "lua51"))]
395+
#[cfg(not(any(feature = "lua51", feature="luajit"))]
395396
is_vararg: ar.isvararg != 0,
397+
#[cfg(not(feature = "luau"))]
396398
nups: ar.nups as _,
397399
}
398400
}

0 commit comments

Comments
 (0)