lua-users home
lua-l archive

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


Hi all,

In ''7.2 The Semantics of the Generic for" section of Pil 3, it refers:   

 (From the standpoint of the for construct, the invariant state has no meaning at all. 
The for only passes the state value from the initialization step to the calls to the iterator
function.)

But in following part: 
   do
        local _f, _s, _var = <explist>
        while true do
            local var_1, ... , var_n = _f(_s, _var)
            _var = var_1
            if _var == nil then break end
                <block>
        end
    end
I can see the "invariant state" is used in every iterator function call. So does it mean although the 
"invariant state" is passed in every iterator function call, but actually iterator function doesn't use it
except the first time?

Thanks in advance!

Best Regards
Nan Xiao