lua-users home
lua-l archive

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



> > Yes I apologize for not providing the German string. The actual source
> > of the problem was the German strings were using "%d$s" instead of "%s"
> > in the unformatted strings, where d is a digit ("%%%d+%$s" as a lua
> > pattern). I had to dig around, but I found that having a "%%%d+" inside
> > a pattern without any captures (or the correct "index" capture) causes
> > the error.
>
> It would be more polite to provide a (minimal) sample that actually
> shows the problem instead of making the list to do the guesswork.

SAMPLE_GERMAN = "%1$s (%2$d/%3$d)";
SAMPLE_ENGLISH = "%s (%d/%d)";

I thought I was pretty clear. I didn't deliberately obfuscate things to make anyone's life more difficult. At the time of my original post, I didn't have access to the German string, I was hoping someone could explain what causes the error. As far as I know, the only cause of this error is capture indices that are out-of-bound:

a,b,c,d = string.find("my dog's name is skip", "([\"'])(.-)%3") --error!

I was hoping someone knew about this (as hinted in my OP) and would say this causes an error.
Perhaps I was too specific for my own good, and should have just plainly asked what causes this error. : (

-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing to do and always a clever thing to say."

-Will Durant