MCPcopy Create free account
hub / github.com/danomatika/ofxLua / floatforloop

Function floatforloop

libs/lua/lvm.c:266–279  ·  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

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

Callers 1

luaV_executeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected