seqlua

changeset 13:2ef6eb7d17d2

More compact coroutine example in README
author jbe
date Wed Aug 20 05:21:16 2014 +0200 (2014-08-20)
parents 91b0d0d4c4dd
children 03ed3361f332
files README
line diff
     1.1 --- a/README	Wed Aug 20 05:18:16 2014 +0200
     1.2 +++ b/README	Wed Aug 20 05:21:16 2014 +0200
     1.3 @@ -78,16 +78,15 @@
     1.4      --  5   e
     1.5      --  6   f
     1.6  
     1.7 -    g = function()
     1.8 +    g = coroutine.wrap(function()
     1.9        coroutine.yield("Alice")
    1.10        coroutine.yield("Bob")
    1.11        for i = 1, 3 do
    1.12          coroutine.yield("Person #" .. tostring(i))
    1.13        end
    1.14 -    end
    1.15 -    h = coroutine.wrap(g)
    1.16 +    end)
    1.17  
    1.18 -    for i, v in ipairs(h) do
    1.19 +    for i, v in ipairs(g) do
    1.20        print(i, v)
    1.21      end
    1.22      -- prints:

Impressum / About Us