lua-users home
lua-l archive

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


well, my suggestion is that any way of passing arguments to functions should
also be available for chunks. functions can be declared with both named and
variadic arguments, so it would be nice if the same could go for chunks as
well:

function ( var1 , var2 , ... ) <---> chunkparams var1 , var2 , ...
function ( var1 , var2 )       <---> chunkparams var1 , var2
function ( ... )               <---> chunkparams ...


OATUR, a discussion occured some time ago about the arg parameter and the
possibility to rename it at will instead of having this predefined name. Has
this been dropped ? I'd love to have something like that :-)

function myFunc ( var1 , var2 , ... = myTableOfVariadicArguments )
	if myTableOfVariadicArguments [ 1 ]
	then
		print "got additional args"
	end
end



-----Message d'origine-----
De : Wim Couwenberg [mailto:w.couwenberg@chello.nl]
Envoyé : vendredi 21 février 2003 10:11
À : Multiple recipients of list
Objet : Re: [new feature proposal for versions after 5.0 final] passing
arguments to chunks


Hi,

> My suggestion is to enable argument
> passing, as is possible for any "regular" function call

[... snip snip ...]
> Of course this
> requires a syntax addition which could look like :
> chunkparams <param list>

This would be useful.  I've been thinking about this same feature, only I
would suggest (just another option) to use the "arg" parameter for chunks,
i.e. as if they have a (...) param list.

Bye,
Wim