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

Function fornum

third-party/lua-5.4.6/src/lparser.c:1568–1588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1566
1567
1568static void fornum (LexState *ls, TString *varname, int line) {
1569 /* fornum -> NAME = exp,exp[,exp] forbody */
1570 FuncState *fs = ls->fs;
1571 int base = fs->freereg;
1572 new_localvarliteral(ls, "(for state)");
1573 new_localvarliteral(ls, "(for state)");
1574 new_localvarliteral(ls, "(for state)");
1575 new_localvar(ls, varname);
1576 checknext(ls, '=');
1577 exp1(ls); /* initial value */
1578 checknext(ls, ',');
1579 exp1(ls); /* limit */
1580 if (testnext(ls, ','))
1581 exp1(ls); /* optional step */
1582 else { /* default step = 1 */
1583 luaK_int(fs, fs->freereg, 1);
1584 luaK_reserveregs(fs, 1);
1585 }
1586 adjustlocalvars(ls, 3); /* control variables */
1587 forbody(ls, base, line, 1, 0);
1588}
1589
1590
1591static void forlist (LexState *ls, TString *indexname) {

Callers 1

forstatFunction · 0.70

Calls 8

new_localvarFunction · 0.70
checknextFunction · 0.70
exp1Function · 0.70
testnextFunction · 0.70
luaK_intFunction · 0.70
luaK_reserveregsFunction · 0.70
adjustlocalvarsFunction · 0.70
forbodyFunction · 0.70

Tested by

no test coverage detected