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 /lobject.c | |
parent | bc82b4d78acd281f68f2f6fcd79395bbee32ee19 (diff) | |
download | lua-github-fabdaa37b62ee9daf2d87a1e6a587820e47a3a34.tar.gz |
'lua_pushfstring' raises an error if called with invalid format
Diffstat (limited to 'lobject.c')
-rw-r--r-- | lobject.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 2.25 2007/04/10 12:18:17 roberto Exp roberto $ +** $Id: lobject.c,v 2.26 2007/11/09 18:54:25 roberto Exp roberto $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -15,6 +15,7 @@ #include "lua.h" +#include "ldebug.h" #include "ldo.h" #include "lmem.h" #include "lobject.h" @@ -133,11 +134,9 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { break; } default: { - char buff[3]; - buff[0] = '%'; - buff[1] = *(e+1); - buff[2] = '\0'; - pushstr(L, buff); + luaG_runerror(L, + "invalid option " LUA_QL("%%%c") " to " LUA_QL("lua_pushfstring"), + *(e + 1)); break; } } |