diff options
Diffstat (limited to 'ldblib.c')
| -rw-r--r-- | ldblib.c | 24 |
1 files changed, 12 insertions, 12 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldblib.c,v 1.69 2002/09/05 19:45:42 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.70 2002/09/16 19:18:01 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 | */ |
| @@ -32,7 +32,7 @@ static void settabsi (lua_State *L, const char *i, int v) { | |||
| 32 | 32 | ||
| 33 | static int getinfo (lua_State *L) { | 33 | static int getinfo (lua_State *L) { |
| 34 | lua_Debug ar; | 34 | lua_Debug ar; |
| 35 | const char *options = luaL_opt_string(L, 2, "flnSu"); | 35 | const char *options = luaL_optstring(L, 2, "flnSu"); |
| 36 | if (lua_isnumber(L, 1)) { | 36 | if (lua_isnumber(L, 1)) { |
| 37 | if (!lua_getstack(L, (int)(lua_tonumber(L, 1)), &ar)) { | 37 | if (!lua_getstack(L, (int)(lua_tonumber(L, 1)), &ar)) { |
| 38 | lua_pushnil(L); /* level out of range */ | 38 | lua_pushnil(L); /* level out of range */ |
| @@ -81,9 +81,9 @@ static int getinfo (lua_State *L) { | |||
| 81 | static int getlocal (lua_State *L) { | 81 | static int getlocal (lua_State *L) { |
| 82 | lua_Debug ar; | 82 | lua_Debug ar; |
| 83 | const char *name; | 83 | const char *name; |
| 84 | if (!lua_getstack(L, luaL_check_int(L, 1), &ar)) /* level out of range? */ | 84 | if (!lua_getstack(L, luaL_checkint(L, 1), &ar)) /* level out of range? */ |
| 85 | return luaL_argerror(L, 1, "level out of range"); | 85 | return luaL_argerror(L, 1, "level out of range"); |
| 86 | name = lua_getlocal(L, &ar, luaL_check_int(L, 2)); | 86 | name = lua_getlocal(L, &ar, luaL_checkint(L, 2)); |
| 87 | if (name) { | 87 | if (name) { |
| 88 | lua_pushstring(L, name); | 88 | lua_pushstring(L, name); |
| 89 | lua_pushvalue(L, -2); | 89 | lua_pushvalue(L, -2); |
| @@ -98,10 +98,10 @@ static int getlocal (lua_State *L) { | |||
| 98 | 98 | ||
| 99 | static int setlocal (lua_State *L) { | 99 | static int setlocal (lua_State *L) { |
| 100 | lua_Debug ar; | 100 | lua_Debug ar; |
| 101 | if (!lua_getstack(L, luaL_check_int(L, 1), &ar)) /* level out of range? */ | 101 | if (!lua_getstack(L, luaL_checkint(L, 1), &ar)) /* level out of range? */ |
| 102 | return luaL_argerror(L, 1, "level out of range"); | 102 | return luaL_argerror(L, 1, "level out of range"); |
| 103 | luaL_check_any(L, 3); | 103 | luaL_checkany(L, 3); |
| 104 | lua_pushstring(L, lua_setlocal(L, &ar, luaL_check_int(L, 2))); | 104 | lua_pushstring(L, lua_setlocal(L, &ar, luaL_checkint(L, 2))); |
| 105 | return 1; | 105 | return 1; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| @@ -151,10 +151,10 @@ static int sethook (lua_State *L) { | |||
| 151 | lua_sethook(L, NULL, 0); /* turn off hooks */ | 151 | lua_sethook(L, NULL, 0); /* turn off hooks */ |
| 152 | } | 152 | } |
| 153 | else { | 153 | else { |
| 154 | const char *smask = luaL_check_string(L, 2); | 154 | const char *smask = luaL_checkstring(L, 2); |
| 155 | lua_Number count = luaL_opt_number(L, 3, 0); | 155 | lua_Number count = luaL_optnumber(L, 3, 0); |
| 156 | luaL_check_type(L, 1, LUA_TFUNCTION); | 156 | luaL_checktype(L, 1, LUA_TFUNCTION); |
| 157 | luaL_arg_check(L, count <= LUA_MAXCOUNT, 2, "count too large (>= 2^24)"); | 157 | luaL_argcheck(L, count <= LUA_MAXCOUNT, 2, "count too large (>= 2^24)"); |
| 158 | lua_sethook(L, hookf, makemask(smask, (int)count)); | 158 | lua_sethook(L, hookf, makemask(smask, (int)count)); |
| 159 | } | 159 | } |
| 160 | lua_pushlightuserdata(L, (void *)&KEY_HOOK); | 160 | lua_pushlightuserdata(L, (void *)&KEY_HOOK); |
| @@ -255,7 +255,7 @@ static const luaL_reg dblib[] = { | |||
| 255 | 255 | ||
| 256 | 256 | ||
| 257 | LUALIB_API int lua_dblibopen (lua_State *L) { | 257 | LUALIB_API int lua_dblibopen (lua_State *L) { |
| 258 | luaL_opennamedlib(L, LUA_DBLIBNAME, dblib, 0); | 258 | luaL_openlib(L, LUA_DBLIBNAME, dblib, 0); |
| 259 | lua_pushliteral(L, "_TRACEBACK"); | 259 | lua_pushliteral(L, "_TRACEBACK"); |
| 260 | lua_pushcfunction(L, errorfb); | 260 | lua_pushcfunction(L, errorfb); |
| 261 | lua_settable(L, LUA_GLOBALSINDEX); | 261 | lua_settable(L, LUA_GLOBALSINDEX); |
