lua-users home
lua-l archive

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


Would someone mind explaining how this code works?  It is way beyond
my Lua knowledge.

thanks,
wes

local function F(get,put)
        put("F init")
        while true do
                local line1,token1,value1=get()
                put(line1,token1,value1)
                if token1=="{" then
                        local line2,token2,value2=get()
                        if token2=="}" then
                                for i=1,8 do
                                        put(line2,"nil")
                                        put(line2,",")
                                end
                        end
                        put(line2,token2,value2)
                end
        end
end

function FILTER(get,source)
        FILTER=coroutine.wrap(F)
        FILTER(get,coroutine.yield)
end

--lhf