diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-12-07 16:31:34 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-12-07 16:31:34 -0200 |
| commit | 2ec4fc4295a97852c8cfe4981fd1c9d661ff7ab9 (patch) | |
| tree | 8bd5bc6d99724c2392c8a9e9acc643ad69ef92b9 | |
| parent | 70751dd27c4225955fe018d6829ea45e3e66a51c (diff) | |
| download | lua-2ec4fc4295a97852c8cfe4981fd1c9d661ff7ab9.tar.gz lua-2ec4fc4295a97852c8cfe4981fd1c9d661ff7ab9.tar.bz2 lua-2ec4fc4295a97852c8cfe4981fd1c9d661ff7ab9.zip | |
simpler code for `print'
| -rw-r--r-- | lbaselib.c | 16 |
1 files changed, 3 insertions, 13 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.160 2004/11/18 19:53:49 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.161 2004/12/06 17:53:42 roberto Exp roberto $ |
| 3 | ** Basic library | 3 | ** Basic library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -396,18 +396,8 @@ static int luaB_tostring (lua_State *L) { | |||
| 396 | case LUA_TNIL: | 396 | case LUA_TNIL: |
| 397 | lua_pushliteral(L, "nil"); | 397 | lua_pushliteral(L, "nil"); |
| 398 | break; | 398 | break; |
| 399 | case LUA_TTABLE: | 399 | default: |
| 400 | lua_pushfstring(L, "table: %p", lua_topointer(L, 1)); | 400 | lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1)); |
| 401 | break; | ||
| 402 | case LUA_TFUNCTION: | ||
| 403 | lua_pushfstring(L, "function: %p", lua_topointer(L, 1)); | ||
| 404 | break; | ||
| 405 | case LUA_TUSERDATA: | ||
| 406 | case LUA_TLIGHTUSERDATA: | ||
| 407 | lua_pushfstring(L, "userdata: %p", lua_topointer(L, 1)); | ||
| 408 | break; | ||
| 409 | case LUA_TTHREAD: | ||
| 410 | lua_pushfstring(L, "thread: %p", lua_topointer(L, 1)); | ||
| 411 | break; | 401 | break; |
| 412 | } | 402 | } |
| 413 | return 1; | 403 | return 1; |
