MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaS_init

Function luaS_init

extlibs/lua/src/lstring.c:135–148  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

f_luaopenFunction · 0.85

Calls 2

tablerehashFunction · 0.85
luaC_fixFunction · 0.85

Tested by

no test coverage detected