{"action":"created","issue":{"url":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/977","repository_url":"https://api.github.com/repos/Hammerspoon/hammerspoon","labels_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/977/labels{/name}","comments_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/977/comments","events_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/977/events","html_url":"https://github.com/Hammerspoon/hammerspoon/issues/977","id":174100566,"number":977,"title":"autoreload code is not working","user":{"login":"brandondrew","id":9854,"avatar_url":"https://avatars.githubusercontent.com/u/9854?v=3","gravatar_id":"","url":"https://api.github.com/users/brandondrew","html_url":"https://github.com/brandondrew","followers_url":"https://api.github.com/users/brandondrew/followers","following_url":"https://api.github.com/users/brandondrew/following{/other_user}","gists_url":"https://api.github.com/users/brandondrew/gists{/gist_id}","starred_url":"https://api.github.com/users/brandondrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandondrew/subscriptions","organizations_url":"https://api.github.com/users/brandondrew/orgs","repos_url":"https://api.github.com/users/brandondrew/repos","events_url":"https://api.github.com/users/brandondrew/events{/privacy}","received_events_url":"https://api.github.com/users/brandondrew/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-30T19:11:57Z","updated_at":"2016-08-30T20:01:14Z","closed_at":"2016-08-30T19:39:12Z","body":"The code given for auto-reloading of `init.lua` does not work, at least in the latest version of Hammerspoon (version 0.9.47).\r\n\r\n*If*, however, you change this\r\n\r\n```\r\nhs.pathwatcher.new(os.getenv(\"HOME\") .. \"/.hammerspoon/\", reloadConfig):start()\r\n```\r\n\r\nto \r\n\r\n```\r\nhs.pathwatcher.new(os.getenv(\"HOME\") .. \"/.hammerspoon/init.lua\", reloadConfig):start()\r\n```\r\n\r\nthen it will work (at least for that single file—almost certainly not if you have multiple `.lua` files and you change a different one).\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/comments/243560713","html_url":"https://github.com/Hammerspoon/hammerspoon/issues/977#issuecomment-243560713","issue_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/977","id":243560713,"user":{"login":"asmagill","id":8139480,"avatar_url":"https://avatars.githubusercontent.com/u/8139480?v=3","gravatar_id":"","url":"https://api.github.com/users/asmagill","html_url":"https://github.com/asmagill","followers_url":"https://api.github.com/users/asmagill/followers","following_url":"https://api.github.com/users/asmagill/following{/other_user}","gists_url":"https://api.github.com/users/asmagill/gists{/gist_id}","starred_url":"https://api.github.com/users/asmagill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmagill/subscriptions","organizations_url":"https://api.github.com/users/asmagill/orgs","repos_url":"https://api.github.com/users/asmagill/repos","events_url":"https://api.github.com/users/asmagill/events{/privacy}","received_events_url":"https://api.github.com/users/asmagill/received_events","type":"User","site_admin":false},"created_at":"2016-08-30T20:01:14Z","updated_at":"2016-08-30T20:01:14Z","body":"Actually, unless that local value is referenced as an upvalue by something which won't be collected, eventually it will be as well... If you truly want something that will persist no matter what, you wither have to store it in something global or do something like this:\r\n\r\n~~~lua\r\nlocal watcher\r\nwatcher = hs.pathwatcher.new(\"path\", function()\r\n    local myWatcher = watcher\r\n    hs.reload()\r\nend):start()\r\n~~~\r\n\r\nNow `watcher` can't be collected even when it's out of scope because it's an upvalue to a function which can't be collected because it's referenced in the internal registry used by module callback functions."}}
{"actor":{"display_login":"asmagill"}}