Re: Lua 5.1w crash bug -- '...' related
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Lua 5.1w crash bug -- '...' related
- From: Roberto Ierusalimschy <roberto@...>
- Date: 2004年9月03日 15:06:27 -0300
> BTW: I had hoped that:
>
> function foo(...) print(unpack(arg), '\n') end
> function foo(...) print(..., '\n') end
>
> Would behave differently, with the former printing only the first arg,
> and the latter printing all arguments as if the arguments had
> literally been expanded inline. That's not how it works, huh?
No. The `...' is equivalent to a function that returns multiple
arguments. `...' and unpack(arg) are completely interchangeable.
-- Roberto