| 1030 | |
| 1031 | |
| 1032 | static int string_query (lua_State *L) { |
| 1033 | stringtable *tb = &G(L)->strt; |
| 1034 | int s = cast_int(luaL_optinteger(L, 1, 0)) - 1; |
| 1035 | if (s == -1) { |
| 1036 | lua_pushinteger(L ,tb->size); |
| 1037 | lua_pushinteger(L ,tb->nuse); |
| 1038 | return 2; |
| 1039 | } |
| 1040 | else if (s < tb->size) { |
| 1041 | TString *ts; |
| 1042 | int n = 0; |
| 1043 | for (ts = tb->hash[s]; ts != NULL; ts = ts->u.hnext) { |
| 1044 | setsvalue2s(L, L->top.p, ts); |
| 1045 | api_incr_top(L); |
| 1046 | n++; |
| 1047 | } |
| 1048 | return n; |
| 1049 | } |
| 1050 | else return 0; |
| 1051 | } |
| 1052 | |
| 1053 | |
| 1054 | static int tref (lua_State *L) { |
nothing calls this directly
no test coverage detected