[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: yield across metamethod/C-call ?
- From: Michal Kolodziejczyk <miko@...>
- Date: Tue, 16 Feb 2010 18:22:03 +0100
On 16.02.2010 17:56, Valerio Schiavoni wrote:
> Hello everyone,
> can anyone explain me what's happening running this simple lua script:
>
> --metaerror.lua
> coroutine.create(coroutine.yield())
This example is not valid, so the behaviour is undefined.
http://www.lua.org/manual/5.1/manual.html#pdf-coroutine.create
"Creates a new coroutine, with body f. f must be a Lua function."
Try this instead:
coroutine.create(function() coroutine.yield() end)
> I've searched on google for that error, but many references belong to
> the interaction between C++ and Lua code. Here it's only Lua.
> I agree that that kind of code is not really very useful..but I'd like
> to understand it.
The function expects the argument as a lua function, and you give it a C
function (check it out with debug.getinfo()).
Regards,
miko