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

Function mainfunc

third-party/lua-5.2.4/src/lparser.c:1604–1615  ·  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

1602** upvalue named LUA_ENV
1603*/
1604static void mainfunc (LexState *ls, FuncState *fs) {
1605 BlockCnt bl;
1606 expdesc v;
1607 open_func(ls, fs, &bl);
1608 fs->f->is_vararg = 1; /* main function is always vararg */
1609 init_exp(&v, VLOCAL, 0); /* create and... */
1610 newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */
1611 luaX_next(ls); /* read first token */
1612 statlist(ls); /* parse main body */
1613 check(ls, TK_EOS);
1614 close_func(ls);
1615}
1616
1617
1618Closure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,

Callers 1

luaY_parserFunction · 0.70

Calls 7

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

Tested by

no test coverage detected