[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: CHanging the order of parameters, is that possible?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sun, 6 Jan 2013 19:48:49 +0200
2013/1/5 Marc Balmer <marc@msys.ch>:
> Is it possible to change the order of parameters in a function taking varargs? Maybe using the select(n, ...) function?
>
> This is what I want to do:
>
> function foo(fmt, ...)
> -- switch element 1 and 2 of {...}
>
> print(string.format('%d %s', ...))
> end
>
function switch23(fmt,a,b,...)
return fmt,b,a,...
end
function foo(fmt,...)
print (string.format(switch23(fmt,...)))
end
foo('%d %s', 'first', 1)