MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaS_init

Function luaS_init

third-party/lua-5.5.0/src/lstring.c:133–146  ·  view source on GitHub ↗

** Initialize the string table and the string cache */

Source from the content-addressed store, hash-verified

131** Initialize the string table and the string cache
132*/
133void luaS_init (lua_State *L) {
134 global_State *g = G(L);
135 int i, j;
136 stringtable *tb = &G(L)->strt;
137 tb->hash = luaM_newvector(L, MINSTRTABSIZE, TString*);
138 tablerehash(tb->hash, 0, MINSTRTABSIZE); /* clear array */
139 tb->size = MINSTRTABSIZE;
140 /* pre-create memory-error message */
141 g->memerrmsg = luaS_newliteral(L, MEMERRMSG);
142 luaC_fix(L, obj2gco(g->memerrmsg)); /* it should never be collected */
143 for (i = 0; i < STRCACHE_N; i++) /* fill cache with valid strings */
144 for (j = 0; j < STRCACHE_M; j++)
145 g->strcache[i][j] = g->memerrmsg;
146}
147
148
149size_t luaS_sizelngstr (size_t len, int kind) {

Callers 1

f_luaopenFunction · 0.70

Calls 2

tablerehashFunction · 0.70
luaC_fixFunction · 0.70

Tested by

no test coverage detected