** 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.) */
| 264 | ** written online with opcode OP_FORLOOP, for performance.) |
| 265 | */ |
| 266 | static 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 | /* |