-
Notifications
You must be signed in to change notification settings - Fork 587
Coroutines
Coroutines are a Lua feature that has had a bit of a tumultuous history with Hammerspoon. As a somewhat advanced Lua construct, they have not been used directly until recently, and it was discovered that prior to Hammerspoon version 0.9.79, coroutines and Hammerspoon specific modules utilizing LuaSkin were fundamentally broken.
This has been addressed, but should be considered a work in progress -- if your attempts to use coroutines result in application crashes or (when you're lucky) a crashlog to the Hammerspoon console, please visit https://github.com/Hammerspoon/hammerspoon/issues and open a new issue with as much detail about what you are trying to do including specific Hammerspoon modules you are attempting to use within your coroutines.
To leverage coroutines in Hammerspoon witihn your own code to make it more responsive, please consult Leveraging Coroutines in Hammerspoon.
For those new to coroutines in general, please consult the following:
- The Lua documentation
- Your preferred Lua Reference guide; I've used the third and fourth editions of Programming in Lua to good effect
For those writing modules to extend Hammerspoon or just interested in the underlying problem and how it's been addressed within Hammerspoon, please consult: