new format "%I" in 'lua_pushfstring' for lua_Integer

This commit is contained in:
Roberto Ierusalimschy
2013-04-25 10:53:13 -03:00
parent 01b6fe0cbf
commit 9c43d6a24e
2 changed files with 20 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lobject.c,v 2.58 2013/02/20 14:08:56 roberto Exp roberto $
** $Id: lobject.c,v 2.59 2013/04/16 18:46:28 roberto Exp roberto $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
@@ -219,6 +219,13 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
setnvalue(L->top++, cast_num(va_arg(argp, int)));
break;
}
case 'I': {
char buff[LUA_MAXINTEGER2STR];
lua_Integer i = cast(lua_Integer, va_arg(argp, lua_Integer));
int l = lua_integer2str(buff, i);
pushstr(L, buff, l);
break;
}
case 'f': {
setnvalue(L->top++, cast_num(va_arg(argp, l_uacNumber)));
break;