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

Function mainfunc

extlibs/lua/src/lparser.c:1943–1957  ·  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

1941** upvalue named LUA_ENV
1942*/
1943static void mainfunc (LexState *ls, FuncState *fs) {
1944 BlockCnt bl;
1945 Upvaldesc *env;
1946 open_func(ls, fs, &bl);
1947 setvararg(fs, 0); /* main function is always declared vararg */
1948 env = allocupvalue(fs); /* ...set environment upvalue */
1949 env->instack = 1;
1950 env->idx = 0;
1951 env->kind = VDKREG;
1952 env->name = ls->envn;
1953 luaX_next(ls); /* read first token */
1954 statlist(ls); /* parse main body */
1955 check(ls, TK_EOS);
1956 close_func(ls);
1957}
1958
1959
1960LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,

Callers 1

luaY_parserFunction · 0.85

Calls 7

open_funcFunction · 0.85
setvarargFunction · 0.85
allocupvalueFunction · 0.85
luaX_nextFunction · 0.85
statlistFunction · 0.85
close_funcFunction · 0.85
checkFunction · 0.70

Tested by

no test coverage detected