aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lauxlib.c14
-rw-r--r--lobject.c9
2 files changed, 20 insertions, 3 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 286e0430..c2620357 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.247 2012/10/19 15:55:01 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.248 2013/03/21 13:54:57 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -737,7 +737,17 @@ LUALIB_API int luaL_len (lua_State *L, int idx) {
737LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { 737LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
738 if (!luaL_callmeta(L, idx, "__tostring")) { /* no metafield? */ 738 if (!luaL_callmeta(L, idx, "__tostring")) { /* no metafield? */
739 switch (lua_type(L, idx)) { 739 switch (lua_type(L, idx)) {
740 case LUA_TNUMBER: 740 case LUA_TNUMBER: {
741 if (lua_isinteger(L, idx)) {
742 lua_Integer n = lua_tointeger(L, idx);
743 lua_pushfstring(L, "%I", n);
744 }
745 else {
746 lua_Number n = lua_tonumber(L, idx);
747 lua_pushfstring(L, "%f", n);
748 }
749 break;
750 }
741 case LUA_TSTRING: 751 case LUA_TSTRING:
742 lua_pushvalue(L, idx); 752 lua_pushvalue(L, idx);
743 break; 753 break;
diff --git a/lobject.c b/lobject.c
index 53de02a0..aab98c66 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 2.58 2013/02/20 14:08:56 roberto Exp roberto $ 2** $Id: lobject.c,v 2.59 2013/04/16 18:46:28 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -219,6 +219,13 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
219 setnvalue(L->top++, cast_num(va_arg(argp, int))); 219 setnvalue(L->top++, cast_num(va_arg(argp, int)));
220 break; 220 break;
221 } 221 }
222 case 'I': {
223 char buff[LUA_MAXINTEGER2STR];
224 lua_Integer i = cast(lua_Integer, va_arg(argp, lua_Integer));
225 int l = lua_integer2str(buff, i);
226 pushstr(L, buff, l);
227 break;
228 }
222 case 'f': { 229 case 'f': {
223 setnvalue(L->top++, cast_num(va_arg(argp, l_uacNumber))); 230 setnvalue(L->top++, cast_num(va_arg(argp, l_uacNumber)));
224 break; 231 break;