pub struct function;Expand description
The type of Lua and C functions.
Functions are first-class values: they can be stored in variables and tables, passed as arguments, and returned from other functions.
A variadic function collects its extra arguments in a vararg
table, whose field n holds their count. Since Lua 5.5 that table
can be given a name after the three dots, becoming a read-only local:
local function f(...args)
print(args.n, args[1])
end
f("a", "b") --> 2 alocal greet = function(name)
return "hello, " .. name
end
print(greet("world"))Auto Trait Implementations§
impl Freeze for function
impl RefUnwindSafe for function
impl Send for function
impl Sync for function
impl Unpin for function
impl UnsafeUnpin for function
impl UnwindSafe for function
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more