[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: resuming a into dofile
- From: Arithmeth <arithmeth@...>
- Date: Fri, 20 Jul 2007 10:36:58 +0200
Hello everybody,
I am trying to do the following: create a coroutine, run a dofile inside it, yielding from the file called with dofile, then resuming again the coroutine.
Here are the two files:
-----------------------------------------------------
-- file1.lua
function f ()
print ("file1.lua: f(): running file2.lua")
dofile("file2.lua")
end
cof = coroutine.create (f)
coroutine.resume (cof)
-- cannot resume the coroutine !!
coroutine.resume (cof)
-----------------------------------------------------
-- file2.lua
print ("file2.lua: PART A")
coroutine.yield()
print ("file2: PART B")
Why "PART B" is not executed as I expected. It probably has to do with my misunderstanding of dofile. Can anyone point me the problem?
Best regards,
-a