aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lstrlib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lstrlib.c b/lstrlib.c
index 2efed9c0..ccecd311 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.163 2011/01/26 16:30:02 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.164 2011/02/07 19:15:24 roberto Exp roberto $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -889,16 +889,16 @@ static int str_format (lua_State *L) {
889 } 889 }
890 case 's': { 890 case 's': {
891 size_t l; 891 size_t l;
892 const char *s = luaL_checklstring(L, arg, &l); 892 const char *s = luaL_tolstring(L, arg, &l);
893 if (!strchr(form, '.') && l >= 100) { 893 if (!strchr(form, '.') && l >= 100) {
894 /* no precision and string is too long to be formatted; 894 /* no precision and string is too long to be formatted;
895 keep original string */ 895 keep original string */
896 lua_pushvalue(L, arg);
897 luaL_addvalue(&b); 896 luaL_addvalue(&b);
898 break; 897 break;
899 } 898 }
900 else { 899 else {
901 nb = sprintf(buff, form, s); 900 nb = sprintf(buff, form, s);
901 lua_pop(L, 1); /* remove result from 'luaL_tolstring' */
902 break; 902 break;
903 } 903 }
904 } 904 }