lua-users home
lua-l archive

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


function ::= function funcbody
funcbody ::= `(´ [parlist1] `)´ block end
parlist1 ::= namelist [`,´ `...´] | `...´
 
... means vararg function.
 
----- Original Message -----
From: wj
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