** 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.) */
| 269 | ** written online with opcode OP_FORLOOP, for performance.) |
| 270 | */ |
| 271 | static 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 | /* |