Function $range

  • Only valid as the expression of a for-of loop!

    Used to compile directly to normal Lua numeric for loops. For example,

    for (const i of $range(1, 10)) {
    print(i);
    }

    will compile into

    for i = 1, 10 do
    print(i)
    end

    The step argument controls the amount incremented per loop. It defaults to 1.

    Parameters

    • start: number
    • finish: number
    • Optional step: number

    Returns Iterable<number>