diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-07-22 13:05:53 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-07-22 13:05:53 -0300 |
| commit | 4244da96bfcf205624487b99b69e9d8dd1857293 (patch) | |
| tree | 3cb62c17f905cab6cac08881483a565a6e4e32ed /ldblib.c | |
| parent | fcf99bf7889ab33d8be84504378c32865f4a60f3 (diff) | |
| download | lua-4244da96bfcf205624487b99b69e9d8dd1857293.tar.gz lua-4244da96bfcf205624487b99b69e9d8dd1857293.tar.bz2 lua-4244da96bfcf205624487b99b69e9d8dd1857293.zip | |
'debug.subtype' -> 'math.type' (to distinguish integers and floats)
Diffstat (limited to 'ldblib.c')
| -rw-r--r-- | ldblib.c | 35 |
1 files changed, 1 insertions, 34 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldblib.c,v 1.133 2013/06/25 19:37:00 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.134 2013/07/10 20:57:05 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 | */ |
| @@ -34,38 +34,6 @@ static int db_numbits (lua_State *L) { | |||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | static int db_subtype (lua_State *L) { | ||
| 38 | int tp = lua_type(L, 1); | ||
| 39 | switch (tp) { | ||
| 40 | case LUA_TNONE: | ||
| 41 | luaL_checkany(L, 1); | ||
| 42 | break; | ||
| 43 | case LUA_TNUMBER: | ||
| 44 | if (lua_isinteger(L, 1)) | ||
| 45 | lua_pushliteral(L, "integer"); | ||
| 46 | else | ||
| 47 | lua_pushliteral(L, "float"); | ||
| 48 | break; | ||
| 49 | case LUA_TFUNCTION: | ||
| 50 | if (lua_iscfunction(L, 1)) | ||
| 51 | lua_pushliteral(L, "Cfunction"); | ||
| 52 | else | ||
| 53 | lua_pushliteral(L, "Luafunction"); | ||
| 54 | break; | ||
| 55 | case LUA_TUSERDATA: | ||
| 56 | if (lua_islightuserdata(L, 1)) | ||
| 57 | lua_pushliteral(L, "lightudata"); | ||
| 58 | else | ||
| 59 | lua_pushliteral(L, "fulludata"); | ||
| 60 | break; | ||
| 61 | default: | ||
| 62 | lua_pushstring(L, lua_typename(L, tp)); | ||
| 63 | break; | ||
| 64 | } | ||
| 65 | return 1; | ||
| 66 | } | ||
| 67 | |||
| 68 | |||
| 69 | static int db_getregistry (lua_State *L) { | 37 | static int db_getregistry (lua_State *L) { |
| 70 | lua_pushvalue(L, LUA_REGISTRYINDEX); | 38 | lua_pushvalue(L, LUA_REGISTRYINDEX); |
| 71 | return 1; | 39 | return 1; |
| @@ -431,7 +399,6 @@ static const luaL_Reg dblib[] = { | |||
| 431 | {"setlocal", db_setlocal}, | 399 | {"setlocal", db_setlocal}, |
| 432 | {"setmetatable", db_setmetatable}, | 400 | {"setmetatable", db_setmetatable}, |
| 433 | {"setupvalue", db_setupvalue}, | 401 | {"setupvalue", db_setupvalue}, |
| 434 | {"subtype", db_subtype}, | ||
| 435 | {"traceback", db_traceback}, | 402 | {"traceback", db_traceback}, |
| 436 | {NULL, NULL} | 403 | {NULL, NULL} |
| 437 | }; | 404 | }; |
