Can’t get this to work….hummm
i read this article https://coronalabs.com/blog/2015/02/10/tutorial-using-coroutines-in-corona/
Here is my simple code
----------- start of code ------------
– main.lua –
local done = false
local function DoSomething()
print(“Did Something”)
end
local function DoSomethingElse()
print (“Did Something Else”)
end
local function WaitUntilTrue( func, update )
while not func() do
if update then
update()
end
print(“yielding”)
coroutine.yield() – attempt to yield across metamethod/C-call boundary
end
end
local pos = { x = 20 }
DoSomething()
transition.to( pos, {
x = 50,
onComplete = function()
done = true – NOW we’re done.
end
})
WaitUntilTrue( function()
return done – Are we done yet?
end )
DoSomethingElse()
------------ end of code ------------
This errors at coroutine.yield() with “attempt to yield across metamethod/C-call boundary”
am i suppose to put a coroutine.create or wrap somewhere??
help, i must be stupid.