diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-10-17 08:07:26 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-10-17 08:07:26 -0300 |
commit | ea3155e380080095a6f8c63297f0505789cf08b7 (patch) | |
tree | 5042b7d258e89ccaa256b1cde1a61d5304108511 /ldblib.c | |
parent | c172a4f7c2d452035f9cbb4285f2e6761ab7a68b (diff) | |
download | lua-ea3155e380080095a6f8c63297f0505789cf08b7.tar.gz lua-ea3155e380080095a6f8c63297f0505789cf08b7.tar.bz2 lua-ea3155e380080095a6f8c63297f0505789cf08b7.zip |
'debug.sizeof' removed
Diffstat (limited to 'ldblib.c')
-rw-r--r-- | ldblib.c | 30 |
1 files changed, 1 insertions, 29 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.141 2014/08/22 16:22:42 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.142 2014/10/01 11:54:56 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 | */ |
@@ -21,33 +21,6 @@ | |||
21 | #define HOOKKEY "_HKEY" | 21 | #define HOOKKEY "_HKEY" |
22 | 22 | ||
23 | 23 | ||
24 | static int db_Csize (lua_State *L) { | ||
25 | static struct { | ||
26 | char c; | ||
27 | unsigned char sz; | ||
28 | } sizes[] = { | ||
29 | {'I', sizeof(lua_Integer)}, | ||
30 | {'F', sizeof(lua_Number)}, | ||
31 | {'h', sizeof(short)}, | ||
32 | {'i', sizeof(int)}, | ||
33 | {'l', sizeof(long)}, | ||
34 | {'z', sizeof(size_t)}, | ||
35 | {'f', sizeof(float)}, | ||
36 | {'d', sizeof(double)}, | ||
37 | {'p', sizeof(void*)} | ||
38 | }; | ||
39 | const char *s = luaL_checkstring(L, 1); | ||
40 | int i; | ||
41 | for (i = 0; i < (int)(sizeof(sizes)/sizeof(sizes[0])); i++) { | ||
42 | if (*s == sizes[i].c) { | ||
43 | lua_pushinteger(L, sizes[i].sz); | ||
44 | return 1; | ||
45 | } | ||
46 | } | ||
47 | return luaL_argerror(L, 1, lua_pushfstring(L, "invalid option '%c'", *s)); | ||
48 | } | ||
49 | |||
50 | |||
51 | static int db_getregistry (lua_State *L) { | 24 | static int db_getregistry (lua_State *L) { |
52 | lua_pushvalue(L, LUA_REGISTRYINDEX); | 25 | lua_pushvalue(L, LUA_REGISTRYINDEX); |
53 | return 1; | 26 | return 1; |
@@ -428,7 +401,6 @@ static int db_traceback (lua_State *L) { | |||
428 | 401 | ||
429 | 402 | ||
430 | static const luaL_Reg dblib[] = { | 403 | static const luaL_Reg dblib[] = { |
431 | {"sizeof", db_Csize}, | ||
432 | {"debug", db_debug}, | 404 | {"debug", db_debug}, |
433 | {"getuservalue", db_getuservalue}, | 405 | {"getuservalue", db_getuservalue}, |
434 | {"gethook", db_gethook}, | 406 | {"gethook", db_gethook}, |