lua-users home
lua-l archive

Re: CHanging the order of parameters, is that possible?

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


Am 05.01.2013 um 17:38 schrieb Thijs Schreijer <thijs@thijsschreijer.nl>:
> pack, change, unpack ?
Yes, I was able to something in this direction. It works now.
Thanks,
Marc
> 
> 
> Marc Balmer <marc@msys.ch> schreef:
> 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
> 
> 
> foo('%s %d', 42, 'balmer')
> 
> (background is doing i18n in Lua, whith messages (= format strings) that can have the order of parameters changed)
Freundliche Grüsse,
micro systems
Marc Balmer
--
Marc Balmer
micro systems, Wiesendamm 2a, Postfach, 4019 Basel
fon +41 61 383 05 10, fax +41 61 383 05 12, http://www.msys.ch/

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