lua-users home
lua-l archive

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



On 12/10/2006, at 2:14 PM, jason bright wrote:

I haven't tried, but first thing that comes to mind is to inject an error
when inside the hook function, but thats an ugly solution.

That's what I did, it never occurred to me that is is ugly.

runaway_instruction_limit = 100000  -- how many instructions

-- this is called if 'runaway_instruction_limit' instructions are done
function hook ()
  error ("Runaway instruction limit reached")
end -- hook

-- put limit on runaway loops
  debug.sethook (hook, "", runaway_instruction_limit)


- Nick