|
|
||
|
static int str_format (lua_State *L) {
case 's': {
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 */
lua_pushvalue(L, arg);
luaL_addvalue(&b);
continue; /* skip the `addsize' at the end */
}
Hi,
I was wondering why Lua's string.format() limits the width and precision fields to two digits. E.g. this doesn't work in Lua because we use a width of 100 (99 works fine):
string.format('%100s', 'hello world')
Is there any particular reason why Lua imposes this limit on string.format()? I'm just wondering because this restriction sometimes makes it difficult to port C code to Lua.
--
Best regards,
Andreas Falkenhahn mailto:andreas@falkenhahn.com