MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / mainfunc

Function mainfunc

libraries/AP_Scripting/lua/src/lparser.c:1612–1623  ·  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

1610** upvalue named LUA_ENV
1611*/
1612static void mainfunc (LexState *ls, FuncState *fs) {
1613 BlockCnt bl;
1614 expdesc v;
1615 open_func(ls, fs, &bl);
1616 fs->f->is_vararg = 1; /* main function is always declared vararg */
1617 init_exp(&v, VLOCAL, 0); /* create and... */
1618 newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */
1619 luaX_next(ls); /* read first token */
1620 statlist(ls); /* parse main body */
1621 check(ls, TK_EOS);
1622 close_func(ls);
1623}
1624
1625
1626LClosure *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.85
close_funcFunction · 0.85

Tested by

no test coverage detected