lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Since this discussion seems to be sparked by the deprecation of ipairs, the other option to consider is whether there's a way to make the value fetch more syntactically lightweight.

    for i,v in ipairs( array ) do
        -- do stuff
    end

Versus:

    for i = 1, #array do
        local v = array[ i ]
        -- do stuff
    end

The latter mentions "array" twice, "i" twice, and has a lot more other material to get "v" created and assigned.

Mark