Dark Byte Site Admin
Reputation: 467
Joined: 09 May 2003 Posts: 25669 Location: The netherlands
|
Posted: Wed Jul 24, 2024 2:39 pm Post subject: Kill frozen lua scripts hotkey |
|
|
If you find yourself frequently writing scripts that freeze because you forgot to add a condition to stop the script if it took too long, then you can use this script:
Code: |
debug.sethook(function(event, line)
if inMainThread() and isKeyPressed(VK_MENU) and isKeyPressed(VK_PAUSE) then
error("Killing lua scripts")
end
end, "crl")
|
this will make alt+pause terminate all scripts that are running in the main GUI thread
2 drawbacks:
1: it will make lua code execute a little slower so do keep that in mind
2: if you use breakpoints in lua to debug your code, this code will stop functioning (currently it overrides the hook and nils on on resume, may change in the future)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|