lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Fri, Mar 19, 2010 at 3:15 PM, Sam Roberts <> wrote:
> On Fri, Mar 19, 2010 at 3:07 PM, Shaun McVey <> wrote:
>> The Lua website itself has a live demo (
>>  Cases like this appear to be protected against.  Unfortunately, I
>> couldn't find any details on the website about how it's implemented.
> Basically using this hook, if I recall correctly:
> If you google a bit you'll find this discussed a bunch of times in the
> list archive, and there might even be a page about it on the lua wiki
> Cheers,
> Sam

As a related question, is it legal in Lua 5.2 to use coroutine.yield
from within a hook callback? Lua 5.1 doesn't allow yielding across
C-call boundaries, but I recall reading that it was possible to some
extent in Lua 5.2. It could be moderately useful to do this when you
have a bunch of unrelated worker coroutines; you could assign
"policies" to them to regulate the amount of time each spends
computing by calling the hook after every X instructions.

~Jonathan Castello