MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / string_query

Function string_query

Dependencies/lua/src/ltests.c:1032–1051  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1030
1031
1032static 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
1054static int tref (lua_State *L) {

Callers

nothing calls this directly

Calls 2

luaL_optintegerFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected