lua-users home
lua-l archive

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

I think I may have found a solution to my problem, it seems to work for the simple use case.  However, I was still curious if this was expected behaviour for coroutines?  Also, does my solution seem reasonable?

debug.sethook(covHandler, "l" )
local oldCreate = coroutine.create
coroutine.create = function( coFunct )
            local callback, opt = debug.gethook()
            return oldCreate( function()
                                 debug.sethook(callback, opt )
                              end )

BTW: This is with Lua 5.1.4, not sure if this changed in 5.2.