diff options
| -rw-r--r-- | ldblib.c | 1 | ||||
| -rw-r--r-- | testes/db.lua | 1 |
2 files changed, 2 insertions, 0 deletions
| @@ -152,6 +152,7 @@ static int db_getinfo (lua_State *L) { | |||
| 152 | lua_State *L1 = getthread(L, &arg); | 152 | lua_State *L1 = getthread(L, &arg); |
| 153 | const char *options = luaL_optstring(L, arg+2, "flnSrtu"); | 153 | const char *options = luaL_optstring(L, arg+2, "flnSrtu"); |
| 154 | checkstack(L, L1, 3); | 154 | checkstack(L, L1, 3); |
| 155 | luaL_argcheck(L, options[0] != '>', arg + 2, "invalid option '>'"); | ||
| 155 | if (lua_isfunction(L, arg + 1)) { /* info about a function? */ | 156 | if (lua_isfunction(L, arg + 1)) { /* info about a function? */ |
| 156 | options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */ | 157 | options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */ |
| 157 | lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */ | 158 | lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */ |
diff --git a/testes/db.lua b/testes/db.lua index ce559ad9..d64952d9 100644 --- a/testes/db.lua +++ b/testes/db.lua | |||
| @@ -31,6 +31,7 @@ end | |||
| 31 | 31 | ||
| 32 | do | 32 | do |
| 33 | assert(not pcall(debug.getinfo, print, "X")) -- invalid option | 33 | assert(not pcall(debug.getinfo, print, "X")) -- invalid option |
| 34 | assert(not pcall(debug.getinfo, 0, ">")) -- invalid option | ||
| 34 | assert(not debug.getinfo(1000)) -- out of range level | 35 | assert(not debug.getinfo(1000)) -- out of range level |
| 35 | assert(not debug.getinfo(-1)) -- out of range level | 36 | assert(not debug.getinfo(-1)) -- out of range level |
| 36 | local a = debug.getinfo(print) | 37 | local a = debug.getinfo(print) |
