co = coroutine.create(function ()
for i=1,10 do
print("co", i)
coroutine.yield()
end
end)
----------------------------------------------------
function setup()
of.setWindowTitle("test11")
of.background(0)
print(coroutine.status(co))
print(co)
coroutine.resume(co)
os.execute("ls")
end
----------------------------------------------------
function update()
end
----------------------------------------------------
function draw()
of.fill()
of.setColor(100,0,130,100)
of.rect(0,0,of.getWidth(), of.getHeight())
of.fill()
of.setColor(0,0,0,100)
of.rect(20,0,of.getWidth(), of.getHeight())
end
function keyPressed(key)
print("script keyPressed \""..tostring(key).."\"")
if key == string.byte("s") then
coroutine.resume(co)
print(coroutine.status(co))
end
end
#+END_SRC
#+BEGIN_SRC Lua
co = coroutine.create(
function ()
for i=1,10 do
of.fill()
of.setColor(255,0,0,100)
of.rect(20*i,0,of.getWidth(), of.getHeight())
coroutine.yield()
end
end)
----------------------------------------------------
function setup()
of.setWindowTitle("test11")
of.background(0)
print(coroutine.status(co))
print(co)
coroutine.resume(co)
os.execute("ls")
end
----------------------------------------------------
function update()
end
----------------------------------------------------
function draw()
end
----------------------------------------------------
function keyPressed(key)
print("script keyPressed \""..tostring(key).."\"")
if key == string.byte("s") then
coroutine.resume(co)
print(coroutine.status(co))
end
end