MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / luaS_init

Function luaS_init

lib/lua/src/lstring.c:123–136  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

121** Initialize the string table and the string cache
122*/
123void luaS_init (lua_State *L) {
124 global_State *g = G(L);
125 int i, j;
126 stringtable *tb = &G(L)->strt;
127 tb->hash = luaM_newvector(L, MINSTRTABSIZE, TString*);
128 tablerehash(tb->hash, 0, MINSTRTABSIZE); /* clear array */
129 tb->size = MINSTRTABSIZE;
130 /* pre-create memory-error message */
131 g->memerrmsg = luaS_newliteral(L, MEMERRMSG);
132 luaC_fix(L, obj2gco(g->memerrmsg)); /* it should never be collected */
133 for (i = 0; i < STRCACHE_N; i++) /* fill cache with valid strings */
134 for (j = 0; j < STRCACHE_M; j++)
135 g->strcache[i][j] = g->memerrmsg;
136}
137
138
139

Callers 1

f_luaopenFunction · 0.85

Calls 3

tablerehashFunction · 0.85
luaC_fixFunction · 0.85
GFunction · 0.50

Tested by

no test coverage detected