MCPcopy Create free account
hub / github.com/PlutoLang/Pluto / floatforloop

Function floatforloop

src/lvm.cpp:271–283  ·  view source on GitHub ↗

** Execute a step of a float numerical for loop, returning ** true iff the loop must continue. (The integer case is ** written online with opcode OP_FORLOOP, for performance.) */

Source from the content-addressed store, hash-verified

269** written online with opcode OP_FORLOOP, for performance.)
270*/
271static int floatforloop (StkId ra) {
272 lua_Number step = fltvalue(s2v(ra + 1));
273 lua_Number limit = fltvalue(s2v(ra));
274 lua_Number idx = fltvalue(s2v(ra + 2)); /* control variable */
275 idx = luai_numadd(L, idx, step); /* increment index */
276 if (luai_numlt(0, step) ? luai_numle(idx, limit)
277 : luai_numle(limit, idx)) {
278 chgfltvalue(s2v(ra + 2), idx); /* update control variable */
279 return 1; /* jump back */
280 }
281 else
282 return 0; /* finish the loop */
283}
284
285
286/*

Callers 1

vmcaseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected