diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-07 14:36:56 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-07 14:36:56 -0300 |
| commit | dea6b6da9422f34ad91c8f6ad9ad3ed650e95713 (patch) | |
| tree | 3016b2fbcd67d75c71ee1b190aff2c24ada9b168 /lapi.c | |
| parent | 71144e3ff0cb81bd9b8bb56d94dc76074c638c64 (diff) | |
| download | lua-dea6b6da9422f34ad91c8f6ad9ad3ed650e95713.tar.gz lua-dea6b6da9422f34ad91c8f6ad9ad3ed650e95713.tar.bz2 lua-dea6b6da9422f34ad91c8f6ad9ad3ed650e95713.zip | |
new function `lua_vpushstr' to replace uses of `sprintf'
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 11 |
1 files changed, 9 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 1.188 2002/05/06 15:51:41 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.189 2002/05/06 19:05:10 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -354,6 +354,13 @@ LUA_API void lua_pushstring (lua_State *L, const char *s) { | |||
| 354 | } | 354 | } |
| 355 | 355 | ||
| 356 | 356 | ||
| 357 | LUA_API void lua_vpushstr (lua_State *L, const char *fmt, va_list argp) { | ||
| 358 | lua_lock(L); | ||
| 359 | luaO_vpushstr(L, fmt, argp); | ||
| 360 | lua_unlock(L); | ||
| 361 | } | ||
| 362 | |||
| 363 | |||
| 357 | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { | 364 | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { |
| 358 | Closure *cl; | 365 | Closure *cl; |
| 359 | lua_lock(L); | 366 | lua_lock(L); |
| @@ -514,7 +521,7 @@ LUA_API void lua_setmetatable (lua_State *L, int objindex) { | |||
| 514 | uvalue(obj)->uv.metatable = hvalue(mt); | 521 | uvalue(obj)->uv.metatable = hvalue(mt); |
| 515 | break; | 522 | break; |
| 516 | default: | 523 | default: |
| 517 | luaO_verror(L, "cannot change the meta table of a %.20s", | 524 | luaO_verror(L, "cannot change the meta table of a %s", |
| 518 | luaT_typenames[ttype(obj)]); | 525 | luaT_typenames[ttype(obj)]); |
| 519 | } | 526 | } |
| 520 | lua_unlock(L); | 527 | lua_unlock(L); |
