diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-12-19 15:24:38 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-12-19 15:24:38 -0200 |
commit | fabdaa37b62ee9daf2d87a1e6a587820e47a3a34 (patch) | |
tree | 5614bb34b464a3fc7145de69a2fb4f69201b736a | |
parent | bc82b4d78acd281f68f2f6fcd79395bbee32ee19 (diff) | |
download | lua-fabdaa37b62ee9daf2d87a1e6a587820e47a3a34.tar.gz lua-fabdaa37b62ee9daf2d87a1e6a587820e47a3a34.tar.bz2 lua-fabdaa37b62ee9daf2d87a1e6a587820e47a3a34.zip |
'lua_pushfstring' raises an error if called with invalid format
-rw-r--r-- | lobject.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 2.25 2007/04/10 12:18:17 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.26 2007/11/09 18:54:25 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 | */ |
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include "lua.h" | 16 | #include "lua.h" |
17 | 17 | ||
18 | #include "ldebug.h" | ||
18 | #include "ldo.h" | 19 | #include "ldo.h" |
19 | #include "lmem.h" | 20 | #include "lmem.h" |
20 | #include "lobject.h" | 21 | #include "lobject.h" |
@@ -133,11 +134,9 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { | |||
133 | break; | 134 | break; |
134 | } | 135 | } |
135 | default: { | 136 | default: { |
136 | char buff[3]; | 137 | luaG_runerror(L, |
137 | buff[0] = '%'; | 138 | "invalid option " LUA_QL("%%%c") " to " LUA_QL("lua_pushfstring"), |
138 | buff[1] = *(e+1); | 139 | *(e + 1)); |
139 | buff[2] = '\0'; | ||
140 | pushstr(L, buff); | ||
141 | break; | 140 | break; |
142 | } | 141 | } |
143 | } | 142 | } |