Skip to content

Commit 4a25eab

Browse files
authored
Merge pull request #189 from hack3ric/master
`Function::bind`: simply clone the function if args are empty `MultiValue`
2 parents 40fe937 + a6b1783 commit 4a25eab

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/function.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ impl<'lua> Function<'lua> {
210210
let args = args.to_lua_multi(lua)?;
211211
let nargs = args.len() as c_int;
212212

213+
if nargs == 0 {
214+
return Ok(self.clone());
215+
}
216+
213217
if nargs + 1 > ffi::LUA_MAX_UPVALUES {
214218
return Err(Error::BindError);
215219
}

0 commit comments

Comments
 (0)