diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.153 2013/09/03 15:37:10 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.154 2013/09/04 15:34:24 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -730,17 +730,21 @@ static int table_query (lua_State *L) { | |||
730 | 730 | ||
731 | static int string_query (lua_State *L) { | 731 | static int string_query (lua_State *L) { |
732 | stringtable *tb = &G(L)->strt; | 732 | stringtable *tb = &G(L)->strt; |
733 | int s = luaL_optint(L, 2, 0) - 1; | 733 | int s = luaL_optint(L, 1, 0) - 1; |
734 | if (s < 0) { | 734 | if (s == -1) { |
735 | lua_pushinteger(L ,tb->nuse); | ||
736 | lua_pushinteger(L ,tb->size); | 735 | lua_pushinteger(L ,tb->size); |
736 | lua_pushinteger(L ,tb->nuse); | ||
737 | return 2; | 737 | return 2; |
738 | } | 738 | } |
739 | else if (s < tb->size) { | 739 | else if (s < tb->size) { |
740 | TString *ts = tb->hash[s]; | 740 | TString *ts; |
741 | setsvalue2s(L, L->top, ts); | 741 | int n = 0; |
742 | api_incr_top(L); | 742 | for (ts = tb->hash[s]; ts != NULL; ts = ts->tsv.hnext) { |
743 | return 1; | 743 | setsvalue2s(L, L->top, ts); |
744 | api_incr_top(L); | ||
745 | n++; | ||
746 | } | ||
747 | return n; | ||
744 | } | 748 | } |
745 | else return 0; | 749 | else return 0; |
746 | } | 750 | } |