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

Function fornum

third-party/lua-5.3.5/src/lparser.c:1317–1336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1315
1316
1317static void fornum (LexState *ls, TString *varname, int line) {
1318 /* fornum -> NAME = exp1,exp1[,exp1] forbody */
1319 FuncState *fs = ls->fs;
1320 int base = fs->freereg;
1321 new_localvarliteral(ls, "(for index)");
1322 new_localvarliteral(ls, "(for limit)");
1323 new_localvarliteral(ls, "(for step)");
1324 new_localvar(ls, varname);
1325 checknext(ls, '=');
1326 exp1(ls); /* initial value */
1327 checknext(ls, ',');
1328 exp1(ls); /* limit */
1329 if (testnext(ls, ','))
1330 exp1(ls); /* optional step */
1331 else { /* default step = 1 */
1332 luaK_codek(fs, fs->freereg, luaK_intK(fs, 1));
1333 luaK_reserveregs(fs, 1);
1334 }
1335 forbody(ls, base, line, 1, 1);
1336}
1337
1338
1339static 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_codekFunction · 0.70
luaK_intKFunction · 0.70
luaK_reserveregsFunction · 0.70
forbodyFunction · 0.70

Tested by

no test coverage detected