MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / open_func

Function open_func

Source/Misc/lua/src/lua.c:7904–7929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7902
7903
7904static void open_func (LexState *ls, FuncState *fs) {
7905lua_State *L = ls->L;
7906Proto *f = luaF_newproto(L);
7907fs->f = f;
7908fs->prev = ls->fs; /* linked list of funcstates */
7909fs->ls = ls;
7910fs->L = L;
7911ls->fs = fs;
7912fs->pc = 0;
7913fs->lasttarget = -1;
7914fs->jpc = NO_JUMP;
7915fs->freereg = 0;
7916fs->nk = 0;
7917fs->np = 0;
7918fs->nlocvars = 0;
7919fs->nactvar = 0;
7920fs->bl = NULL;
7921f->source = ls->source;
7922f->maxstacksize = 2; /* registers 0/1 are always valid */
7923fs->h = luaH_new(L, 0, 0);
7924/* anchor table of constants and prototype (to avoid being collected) */
7925sethvalue2s(L, L->top, fs->h);
7926incr_top(L);
7927setptvalue2s(L, L->top, f);
7928incr_top(L);
7929}
7930
7931
7932static void close_func (LexState *ls) {

Callers 2

luaY_parserFunction · 0.85
bodyFunction · 0.85

Calls 2

luaF_newprotoFunction · 0.85
luaH_newFunction · 0.85

Tested by

no test coverage detected