MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / mainfunc

Function mainfunc

src/Chain/libraries/glua/lparser.cpp:1681–1694  ·  view source on GitHub ↗

** compiles the main function, which is a regular vararg function with an ** upvalue named LUA_ENV */

Source from the content-addressed store, hash-verified

1679** upvalue named LUA_ENV
1680*/
1681static void mainfunc(LexState *ls, FuncState *fs) {
1682 BlockCnt bl;
1683 expdesc v;
1684 open_func(ls, fs, &bl);
1685 fs->f->is_vararg = 2; /* main function is always declared vararg */
1686 init_exp(&v, VLOCAL, 0); /* create and... */
1687 newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */
1688 luaX_next(ls); /* read first token */
1689 statlist(ls); /* parse main body */
1690 if (ls->L->force_stopping)
1691 return;
1692 check(ls, TK_EOS);
1693 close_func(ls);
1694}
1695
1696
1697LClosure *luaY_parser(lua_State *L, ZIO *z, Mbuffer *buff,

Callers 1

luaY_parserFunction · 0.85

Calls 7

open_funcFunction · 0.85
init_expFunction · 0.85
newupvalueFunction · 0.85
luaX_nextFunction · 0.85
statlistFunction · 0.85
checkFunction · 0.70
close_funcFunction · 0.70

Tested by

no test coverage detected