|
@ -1,5 +1,5 @@ |
|
|
/*
|
|
|
/*
|
|
|
** $Id: lstrlib.c,v 1.141 2008/06/12 14:21:18 roberto Exp roberto $ |
|
|
** $Id: lstrlib.c,v 1.142 2009/02/03 19:39:19 roberto Exp roberto $ |
|
|
** Standard library for string operations and pattern-matching |
|
|
** Standard library for string operations and pattern-matching |
|
|
** See Copyright Notice in lua.h |
|
|
** See Copyright Notice in lua.h |
|
|
*/ |
|
|
*/ |
|
@ -777,14 +777,13 @@ static int str_format (lua_State *L) { |
|
|
sprintf(buff, form, (int)luaL_checknumber(L, arg)); |
|
|
sprintf(buff, form, (int)luaL_checknumber(L, arg)); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
case 'd': case 'i': { |
|
|
case 'd': case 'i': |
|
|
addintlen(form); |
|
|
|
|
|
sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg)); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
case 'o': case 'u': case 'x': case 'X': { |
|
|
case 'o': case 'u': case 'x': case 'X': { |
|
|
|
|
|
lua_Number n = luaL_checknumber(L, arg); |
|
|
|
|
|
LUA_INTFRM_T r = (n < 0) ? (LUA_INTFRM_T)n : |
|
|
|
|
|
(LUA_INTFRM_T)(unsigned LUA_INTFRM_T)n; |
|
|
addintlen(form); |
|
|
addintlen(form); |
|
|
sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); |
|
|
sprintf(buff, form, r); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
case 'e': case 'E': case 'f': |
|
|
case 'e': case 'E': case 'f': |
|
|