lua-users home
lua-l archive

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


$ cat bug.lua
local function yieldFirst(it)
    return coroutine.wrap(function()
        coroutine.yield(it())
    end)
end

local text = "1 2 3"
local it = text:gmatch("(%d+)")
local head = yieldFirst(it)
local one = head()
print(one)
assert(one == '1')

$ ./lua-5.3.1/src/lua bug.lua
1
$ ./lua-5.3.2/src/lua bug.lua
function: 0x243f820
./lua-5.3.2/src/lua: bug.lua:12: assertion failed!
stack traceback:
        [C]: in function 'assert'
        bug.lua:12: in main chunk
        [C]: in ?

-- 


Best regards,
Boris Nagaev