{"action":"created","issue":{"url":"https://api.github.com/repos/copycat-killer/lain/issues/196","repository_url":"https://api.github.com/repos/copycat-killer/lain","labels_url":"https://api.github.com/repos/copycat-killer/lain/issues/196/labels{/name}","comments_url":"https://api.github.com/repos/copycat-killer/lain/issues/196/comments","events_url":"https://api.github.com/repos/copycat-killer/lain/issues/196/events","html_url":"https://github.com/copycat-killer/lain/pull/196","id":153656889,"number":196,"title":"Support for multiple interfaces on net widget","user":{"login":"Unode","id":122319,"avatar_url":"https://avatars.githubusercontent.com/u/122319?v=3","gravatar_id":"","url":"https://api.github.com/users/Unode","html_url":"https://github.com/Unode","followers_url":"https://api.github.com/users/Unode/followers","following_url":"https://api.github.com/users/Unode/following{/other_user}","gists_url":"https://api.github.com/users/Unode/gists{/gist_id}","starred_url":"https://api.github.com/users/Unode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unode/subscriptions","organizations_url":"https://api.github.com/users/Unode/orgs","repos_url":"https://api.github.com/users/Unode/repos","events_url":"https://api.github.com/users/Unode/events{/privacy}","received_events_url":"https://api.github.com/users/Unode/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/copycat-killer/lain/labels/new%20feature","name":"new feature","color":"c2e0c6"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-08T13:52:43Z","updated_at":"2016-05-08T21:41:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/copycat-killer/lain/pulls/196","html_url":"https://github.com/copycat-killer/lain/pull/196","diff_url":"https://github.com/copycat-killer/lain/pull/196.diff","patch_url":"https://github.com/copycat-killer/lain/pull/196.patch"},"body":"Addresses issue #191 by accepting an array if interface names via `args.iface`.\r\n\r\nCompatibility with old API was kept by detecting if a string was passed.\r\n\r\nFurther testing with multiple devices is welcome."},"comment":{"url":"https://api.github.com/repos/copycat-killer/lain/issues/comments/217747964","html_url":"https://github.com/copycat-killer/lain/pull/196#issuecomment-217747964","issue_url":"https://api.github.com/repos/copycat-killer/lain/issues/196","id":217747964,"user":{"login":"Unode","id":122319,"avatar_url":"https://avatars.githubusercontent.com/u/122319?v=3","gravatar_id":"","url":"https://api.github.com/users/Unode","html_url":"https://github.com/Unode","followers_url":"https://api.github.com/users/Unode/followers","following_url":"https://api.github.com/users/Unode/following{/other_user}","gists_url":"https://api.github.com/users/Unode/gists{/gist_id}","starred_url":"https://api.github.com/users/Unode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unode/subscriptions","organizations_url":"https://api.github.com/users/Unode/orgs","repos_url":"https://api.github.com/users/Unode/repos","events_url":"https://api.github.com/users/Unode/events{/privacy}","received_events_url":"https://api.github.com/users/Unode/received_events","type":"User","site_admin":false},"created_at":"2016-05-08T21:41:48Z","updated_at":"2016-05-08T21:41:48Z","body":"Hi Luke,\r\n\r\nThanks for the feedback.\r\n\r\nWithout lines [56-58](https://github.com/Unode/lain/blob/multiple-net-widget/widgets/net.lua#L56-58) if no interface is requested and no network is up when awesome starts, no device would be considered and the widget would be running on `nil` the whole time. The way it is now it gets defined once a device is up (i.e. array no longer empty). I'll add a comment to clarify the intention.\r\n\r\nLines 82-85 is a typo. Your patch is correct.\r\n\r\n`local dev_before = net_now[dev] or net` is not correct. If we do that and we have more than one device they will share the same array instead of a copy of it. The idea is to have one set of `last_t last_r` per device and one global for the total (sum of all devices).\r\n\r\nI don't see the need for `(dev_before.last_t or 0)` if `local dev_before = net_now[dev] or { last_t = 0, last_r = 0 }` is kept. I can't see how `dev_before.last_t` wouldn't be a number.\r\n\r\nUsing `{ \"wlan0\", \"wlan0\" }` never crossed my mind I can't see why anyone would do that. Still, it was helpful to see the problem you mentioned and a few others related with preserving the global state.\r\n\r\nYou seem to have accidentally merged the pull request in one of your last commits (84313cc876bce8b346ca83934de57b50488ab8cd).\r\n\r\nUpdated pull request with patch suggestion and additional fixes."}}