Page 1 of 1

[solved] Error: attempt to yield across ...

Posted: Sun Nov 18, 2012 8:47 pm
by spir
Is it at all possible to use coroutines with Löve? (I was trying a coooool way to manage processes / sequences of actions that still need to be controlled by events, without loads of state everywhere). I cannot succeed in running (or rather come back from) even the simplest co. I need to know whether it is possible to unblock my debugging mind.

Thank you,
denis

Re: Error: attempt to yield across metamethod/C-call boundar

Posted: Sun Nov 18, 2012 9:03 pm
by bartbes
Well, the error basically says what you're doing wrong, you're trying to yield from within a function called from c++ (a physics callback?) or from within a metamethod (like __index).

Re: Error: attempt to yield across metamethod/C-call boundar

Posted: Sun Nov 18, 2012 11:54 pm
by spir
bartbes wrote:Well, the error basically says what you're doing wrong, you're trying to yield from within a function called from c++ (a physics callback?) or from within a metamethod (like __index).
Right, but isn't everything called from C when I use Löve? The yielding func in question does about nothing (i reduced the error case) and is just called by love.update. But ultimately it is indeed called by the c/++ framework behind the scene, what do you think? That's why I asked whether it is at all possible to "coroutine" and use Löve.

Denis

Re: Error: attempt to yield across metamethod/C-call boundar

Posted: Sun Nov 18, 2012 11:58 pm
by spir
bartbes wrote:Well, the error basically says what you're doing wrong, you're trying to yield from within a function called from c++ (a physics callback?) or from within a metamethod (like __index).
Found my error, was a wrong usage of the coroutine. Thank you for the help,
Denis

Re: Error: attempt to yield across metamethod/C-call boundar

Posted: Mon Nov 19, 2012 9:32 am
by bartbes
spir wrote: Right, but isn't everything called from C when I use Löve?
Specifically, you need to yield across boundaries, meaning from lua->c->lua, which barely ever happens in love.