[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Invalid Capture Index
- From: "Mark Edgar" <medgar123+lua-l@...>
- Date: Fri, 6 Jul 2007 16:46:29 -0700
So, POSIX (and other C implementations) have an extension to printf()
format specifiers allowing them to specify an argument by its
position. So, you can use:
printf("%2$s %1$s\n", "world!", "Hello"); /* prints "Hello world!\n" */
It turns out to be very handy for i18n purposes, because different
languages can have different word orders.
Alas, Lua does not support POSIX format specifier position indicators.
If you have a format string which originally meant for C's printf()
function, it is in general a bad idea to pass it straight into Lua's
string.format() function. They are similar functions, but definitely
not compatible.
-Mark