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

Function fornum

third-party/lua-5.2.4/src/lparser.c:1309–1328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1307
1308
1309static void fornum (LexState *ls, TString *varname, int line) {
1310 /* fornum -> NAME = exp1,exp1[,exp1] forbody */
1311 FuncState *fs = ls->fs;
1312 int base = fs->freereg;
1313 new_localvarliteral(ls, "(for index)");
1314 new_localvarliteral(ls, "(for limit)");
1315 new_localvarliteral(ls, "(for step)");
1316 new_localvar(ls, varname);
1317 checknext(ls, '=');
1318 exp1(ls); /* initial value */
1319 checknext(ls, ',');
1320 exp1(ls); /* limit */
1321 if (testnext(ls, ','))
1322 exp1(ls); /* optional step */
1323 else { /* default step = 1 */
1324 luaK_codek(fs, fs->freereg, luaK_numberK(fs, 1));
1325 luaK_reserveregs(fs, 1);
1326 }
1327 forbody(ls, base, line, 1, 1);
1328}
1329
1330
1331static 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_numberKFunction · 0.70
luaK_reserveregsFunction · 0.70
forbodyFunction · 0.70

Tested by

no test coverage detected