[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (work1) now available
- From: Alexander Gladysh <agladysh@...>
- Date: Tue, 12 Jan 2010 02:36:30 +0300
>> - yieldable pcall/metamethods
> Are for loop iterators yieldable?
Quick test shows that yes, they are. Hope that is official. :-)
$ ./lua
Lua 5.2.0 (work1) Copyright (C) 1994-2008 Lua.org, PUC-Rio
> f = function()for k, v in function() coroutine.yield() end, nil, nil do print("XXX") end end
> c = coroutine.create(f)
> assert(coroutine.resume(c))
> assert(coroutine.resume(c))
$ lua
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> f = function()for k, v in function() coroutine.yield() end, nil, nil do print("XXX") end end
> c = coroutine.create(f)
> assert(coroutine.resume(c))
stdin:1: attempt to yield across metamethod/C-call boundary
stack traceback:
[C]: in function 'assert'
stdin:1: in main chunk
[C]: ?
Hurray!
Alexander.