lua-users home
lua-l archive

Re: '...' is a variable,who can explain

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It does raise the question of whether
 type(...)
should return a value?
db
On 1/12/07, jason zhang <jzhang@sunrisetelecom.com.cn> wrote:
function ::= function funcbody
 funcbody ::= `(´ [parlist1] `)´ block end
parlist1 ::= namelist [`,´ `...´] | `...´
... means vararg function.
----- Original Message -----
From: wj
To: lua@bazar2.conectiva.com.br
Sent: Friday, January 12, 2007 1:24 PM
Subject: '...' is a variable,who can explain
look at this code:
--codes begin
function joinFunc(f1,f2)
 return function (...)
 return f1(f2(...)) --...treated as a variable! is it maze!
 end
end
f1 = joinFunc(print,math.abs)
f1(-2) --out:2
--codes end
why the

AltStyle によって変換されたページ (->オリジナル) /