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

Function fornum

third-party/lua-5.5.0/src/lparser.c:1685–1704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1683
1684
1685static void fornum (LexState *ls, TString *varname, int line) {
1686 /* fornum -> NAME = exp,exp[,exp] forbody */
1687 FuncState *fs = ls->fs;
1688 int base = fs->freereg;
1689 new_localvarliteral(ls, "(for state)");
1690 new_localvarliteral(ls, "(for state)");
1691 new_varkind(ls, varname, RDKCONST); /* control variable */
1692 checknext(ls, '=');
1693 exp1(ls); /* initial value */
1694 checknext(ls, ',');
1695 exp1(ls); /* limit */
1696 if (testnext(ls, ','))
1697 exp1(ls); /* optional step */
1698 else { /* default step = 1 */
1699 luaK_int(fs, fs->freereg, 1);
1700 luaK_reserveregs(fs, 1);
1701 }
1702 adjustlocalvars(ls, 2); /* start scope for internal variables */
1703 forbody(ls, base, line, 1, 0);
1704}
1705
1706
1707static void forlist (LexState *ls, TString *indexname) {

Callers 1

forstatFunction · 0.70

Calls 8

new_varkindFunction · 0.85
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