lua-users home
lua-l archive

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


> It's due to this check in lstrlib.c (this one taken from 5.1, but 5.2
> and 5.3 are pretty much the same):
> 
>           size_t l;
>           const char *s = luaL_checklstring(L, arg, &l);
>           if (!strchr(form, '.') && l >= 100) {
>             /* no precision and string is too long to be formatted;
>                keep original string */
>             [...]
>           }
>           else {
>             sprintf(buff, form, s);
>             break;
>           }
> 
> [...]
> 
> Btw, In the current code, I don't think that `form` can ever contain a
> '.' when l > 99, so the first predicate can be ignored.

I think the following format has '.' in 'form' and l > 99 (and needs that
test to be properly formatted):

  string.format("%9.5s", string.rep("a", 1000))


-- Roberto