lua-users home
lua-l archive

Re: [ANN] Lua 5.4.0 (alpha-rc1) now available

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


It was thus said that the Great Andrew Gierth once stated:
> >>>>> "Roberto" == Roberto Ierusalimschy <roberto@inf.puc-rio.br> writes:
> 
> >> That said, why have the "tocont" argument rather than doing it
> >> printf-style? i.e. make the signature of the user-supplied warning
> >> function take a va_list, a la vfprintf.
> 
> Roberto> Any suggestion about how to export that to Lua? That is, how
> Roberto> to implementt a "warn(msg1, msg2, ..., msgN)" for Lua with a
> Roberto> single call to such a lua_warn?
> 
> Do you need to?
> 
> I don't see any strong reason why the Lua warn() should take multiple
> parameters, since the caller can always construct their own warning
> string.
 I would prefer:
	warn("The %s is at %d blahs, we're about to blow!",foo,level)
instead of:
	warn(string.format("The %s is at %d blahs, we're about to blow!",foo,level))
And I know I can always do:
	do
	 local syswarn = warn
	 function warn(fmt,...)
	 return syswarn(string.format(fmt,...))
	 end
	end
but to me, that's sub-optimal.
 -spc

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