diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-16 15:39:46 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-16 15:39:46 -0300 |
| commit | 955def034814e96f5f8e42def2e47ca6817ef103 (patch) | |
| tree | d8eea96980860d1d1e5005ee6ecedb47fa64d594 /ldblib.c | |
| parent | 9c3b3f82fe1b0942183ddeef2e16d60bab4f4c06 (diff) | |
| download | lua-955def034814e96f5f8e42def2e47ca6817ef103.tar.gz lua-955def034814e96f5f8e42def2e47ca6817ef103.tar.bz2 lua-955def034814e96f5f8e42def2e47ca6817ef103.zip | |
new names for string formating functions
Diffstat (limited to 'ldblib.c')
| -rw-r--r-- | ldblib.c | 17 |
1 files changed, 9 insertions, 8 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldblib.c,v 1.51 2002/05/07 17:36:56 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.52 2002/05/15 18:57:44 roberto Exp roberto $ |
| 3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -41,7 +41,7 @@ static int getinfo (lua_State *L) { | |||
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | else if (lua_isfunction(L, 1)) { | 43 | else if (lua_isfunction(L, 1)) { |
| 44 | luaL_vstr(L, ">%s", options); | 44 | lua_pushfstring(L, ">%s", options); |
| 45 | options = lua_tostring(L, -1); | 45 | options = lua_tostring(L, -1); |
| 46 | lua_pushvalue(L, 1); | 46 | lua_pushvalue(L, 1); |
| 47 | } | 47 | } |
| @@ -207,23 +207,24 @@ static int errorfb (lua_State *L) { | |||
| 207 | sprintf(buff, "%4d- ", level-1); | 207 | sprintf(buff, "%4d- ", level-1); |
| 208 | lua_pushstring(L, buff); | 208 | lua_pushstring(L, buff); |
| 209 | lua_getinfo(L, "Snl", &ar); | 209 | lua_getinfo(L, "Snl", &ar); |
| 210 | luaL_vstr(L, "%s:", ar.short_src); | 210 | lua_pushfstring(L, "%s:", ar.short_src); |
| 211 | if (ar.currentline > 0) | 211 | if (ar.currentline > 0) |
| 212 | luaL_vstr(L, "%d:", ar.currentline); | 212 | lua_pushfstring(L, "%d:", ar.currentline); |
| 213 | switch (*ar.namewhat) { | 213 | switch (*ar.namewhat) { |
| 214 | case 'g': /* global */ | 214 | case 'g': /* global */ |
| 215 | case 'l': /* local */ | 215 | case 'l': /* local */ |
| 216 | case 'f': /* field */ | 216 | case 'f': /* field */ |
| 217 | case 'm': /* method */ | 217 | case 'm': /* method */ |
| 218 | luaL_vstr(L, " in function `%s'", ar.name); | 218 | lua_pushfstring(L, " in function `%s'", ar.name); |
| 219 | break; | 219 | break; |
| 220 | default: { | 220 | default: { |
| 221 | if (*ar.what == 'm') /* main? */ | 221 | if (*ar.what == 'm') /* main? */ |
| 222 | luaL_vstr(L, " in main chunk"); | 222 | lua_pushfstring(L, " in main chunk"); |
| 223 | else if (*ar.what == 'C') /* C function? */ | 223 | else if (*ar.what == 'C') /* C function? */ |
| 224 | luaL_vstr(L, "%s", ar.short_src); | 224 | lua_pushfstring(L, "%s", ar.short_src); |
| 225 | else | 225 | else |
| 226 | luaL_vstr(L, " in function <%s:%d>", ar.short_src, ar.linedefined); | 226 | lua_pushfstring(L, " in function <%s:%d>", |
| 227 | ar.short_src, ar.linedefined); | ||
| 227 | } | 228 | } |
| 228 | } | 229 | } |
| 229 | lua_pushliteral(L, "\n"); | 230 | lua_pushliteral(L, "\n"); |
