lua-users home
lua-l archive

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


On 31.07.2017 19:29, Gunnar Zötl wrote:
My idea for this was to install a hook, probably a count hook, that checks for a flag to see whether the thread has been aborted, and if it has, just raises an error. This would abort the vm at the earliest convenient opportunity, and also offer the ability to handle te abort from within lua (to do some cleanup or whatever).

I use exactly this mechanism in my Lua environment. I would say it is a quite good mechanism.
What you might have to think about, do you want errors from your hook to be caught by pcall within a script or not.
Both is possible, you should just use one approach an stick to it. Probably in your scenario you don't want pcall to catch a error from the hook.
--
Thomas