{"action":"created","comment":{"url":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/comments/75037925","id":75037925,"diff_hunk":"@@ -0,0 +1,735 @@\n+local source = [[\n+--\t// FileName: ChatMain.lua\n+--\t// Written by: Xsitsu\n+--\t// Description: Main module to handle initializing chat window UI and chatting.\n+\n+local moduleApiTable = {}\n+\n+\n+--// This section of code waits until all of the necessary RemoteEvents are found in EventFolder.\n+--// I have to do some weird stuff since people could potentially already have pre-existing \n+--// things in a folder with the same name, and they may have different class types.\n+--// I do the useEvents thing and set EventFolder to useEvents so I can have a pseudo folder that \n+--// the rest of the code can interface with and have the guarantee that the RemoteEvents they want \n+--// exist with their desired names.\n+\n+local EventFolder = game:GetService(\"ReplicatedStorage\"):WaitForChild(\"DefaultChatSystemChatEvents\")\n+\n+local numChildrenRemaining = 10 -- #waitChildren returns 0 because it's a dictionary\n+local waitChildren = \n+{\n+\tOnNewMessage = true,\n+\tOnNewSystemMessage = true,\n+\tOnChannelJoined = true,\n+\tOnChannelLeft = true,\n+\tOnMuted = true,\n+\tOnUnmuted = true,\n+\tOnSpeakerExtraDataUpdated = true,\n+\tOnMainChannelSet = true,\n+\n+\tSayMessageRequest = true,\n+\tGetInitDataRequest = true,\n+}\n+\n+local useEvents = {}\n+\n+local FoundAllEventsEvent = Instance.new(\"BindableEvent\")\n+\n+local function TryRemoveChild(child)\n+\tif (child:IsA(\"RemoteEvent\") and waitChildren[child.Name]) then\n+\t\twaitChildren[child.Name] = nil\n+\t\tuseEvents[child.Name] = child\n+\t\tnumChildrenRemaining = numChildrenRemaining - 1\n+\tend\n+end\n+\n+for i, child in pairs(EventFolder:GetChildren()) do\n+\tTryRemoveChild(child)\n+end\n+\n+if (numChildrenRemaining > 0) then\n+\tlocal con = EventFolder.ChildAdded:connect(function(child)\n+\t\tTryRemoveChild(child)\n+\t\tif (numChildrenRemaining < 1) then\n+\t\t\tFoundAllEventsEvent:Fire()\n+\t\tend\n+\tend)\n+\n+\tFoundAllEventsEvent.Event:wait() -- I love how this turned out\n+\tcon:disconnect()\n+\n+\tFoundAllEventsEvent:Destroy()\n+end","path":"CoreScriptsRoot/ServerCoreScripts/ClientChat/ChatMain.lua","position":62,"original_position":62,"commit_id":"d3a216f7aee96cbf07dcf9e6a5f7c5183ba022cc","original_commit_id":"29e378ffb5533f0b7cbcbc685f492de373366e8f","user":{"login":"SolarCrane","id":6992752,"avatar_url":"https://avatars.githubusercontent.com/u/6992752?v=3","gravatar_id":"","url":"https://api.github.com/users/SolarCrane","html_url":"https://github.com/SolarCrane","followers_url":"https://api.github.com/users/SolarCrane/followers","following_url":"https://api.github.com/users/SolarCrane/following{/other_user}","gists_url":"https://api.github.com/users/SolarCrane/gists{/gist_id}","starred_url":"https://api.github.com/users/SolarCrane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SolarCrane/subscriptions","organizations_url":"https://api.github.com/users/SolarCrane/orgs","repos_url":"https://api.github.com/users/SolarCrane/repos","events_url":"https://api.github.com/users/SolarCrane/events{/privacy}","received_events_url":"https://api.github.com/users/SolarCrane/received_events","type":"User","site_admin":false},"body":"This all seems extraneous, we could just have an array of children and iterate over it calling WaitForChild() on each of them. IIRC WaitForChild only yields if the child doesn't exist yet.","created_at":"2016-08-16T23:11:09Z","updated_at":"2016-08-16T23:11:09Z","html_url":"https://github.com/ROBLOX/Core-Scripts/pull/455#discussion_r75037925","pull_request_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/455","_links":{"self":{"href":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/comments/75037925"},"html":{"href":"https://github.com/ROBLOX/Core-Scripts/pull/455#discussion_r75037925"},"pull_request":{"href":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/455"}}},"pull_request":{"url":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/455","id":77697094,"html_url":"https://github.com/ROBLOX/Core-Scripts/pull/455","diff_url":"https://github.com/ROBLOX/Core-Scripts/pull/455.diff","patch_url":"https://github.com/ROBLOX/Core-Scripts/pull/455.patch","issue_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/issues/455","number":455,"state":"open","locked":false,"title":"New Chat System for Code Review","user":{"login":"JacobLocke","id":19916907,"avatar_url":"https://avatars.githubusercontent.com/u/19916907?v=3","gravatar_id":"","url":"https://api.github.com/users/JacobLocke","html_url":"https://github.com/JacobLocke","followers_url":"https://api.github.com/users/JacobLocke/followers","following_url":"https://api.github.com/users/JacobLocke/following{/other_user}","gists_url":"https://api.github.com/users/JacobLocke/gists{/gist_id}","starred_url":"https://api.github.com/users/JacobLocke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JacobLocke/subscriptions","organizations_url":"https://api.github.com/users/JacobLocke/orgs","repos_url":"https://api.github.com/users/JacobLocke/repos","events_url":"https://api.github.com/users/JacobLocke/events{/privacy}","received_events_url":"https://api.github.com/users/JacobLocke/received_events","type":"User","site_admin":false},"body":"Not currently in a state for deployment. This will be updated over time with fixes and improvements.\r\nStarted pull request now for code review.\r\n\r\nEdit: It is actually now totally ready to be pulled in!\r\n","created_at":"2016-07-16T01:39:08Z","updated_at":"2016-08-16T23:11:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b9fb5bf5a50bf4d34affba58087a05e1db4c2121","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/455/commits","review_comments_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/455/comments","review_comment_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/issues/455/comments","statuses_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/statuses/d3a216f7aee96cbf07dcf9e6a5f7c5183ba022cc","head":{"label":"JacobLocke:master","ref":"master","sha":"d3a216f7aee96cbf07dcf9e6a5f7c5183ba022cc","user":{"login":"JacobLocke","id":19916907,"avatar_url":"https://avatars.githubusercontent.com/u/19916907?v=3","gravatar_id":"","url":"https://api.github.com/users/JacobLocke","html_url":"https://github.com/JacobLocke","followers_url":"https://api.github.com/users/JacobLocke/followers","following_url":"https://api.github.com/users/JacobLocke/following{/other_user}","gists_url":"https://api.github.com/users/JacobLocke/gists{/gist_id}","starred_url":"https://api.github.com/users/JacobLocke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JacobLocke/subscriptions","organizations_url":"https://api.github.com/users/JacobLocke/orgs","repos_url":"https://api.github.com/users/JacobLocke/repos","events_url":"https://api.github.com/users/JacobLocke/events{/privacy}","received_events_url":"https://api.github.com/users/JacobLocke/received_events","type":"User","site_admin":false},"repo":{"id":61070130,"name":"Core-Scripts","full_name":"JacobLocke/Core-Scripts","owner":{"login":"JacobLocke","id":19916907,"avatar_url":"https://avatars.githubusercontent.com/u/19916907?v=3","gravatar_id":"","url":"https://api.github.com/users/JacobLocke","html_url":"https://github.com/JacobLocke","followers_url":"https://api.github.com/users/JacobLocke/followers","following_url":"https://api.github.com/users/JacobLocke/following{/other_user}","gists_url":"https://api.github.com/users/JacobLocke/gists{/gist_id}","starred_url":"https://api.github.com/users/JacobLocke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JacobLocke/subscriptions","organizations_url":"https://api.github.com/users/JacobLocke/orgs","repos_url":"https://api.github.com/users/JacobLocke/repos","events_url":"https://api.github.com/users/JacobLocke/events{/privacy}","received_events_url":"https://api.github.com/users/JacobLocke/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JacobLocke/Core-Scripts","description":"All of ROBLOX's core client scripts.","fork":true,"url":"https://api.github.com/repos/JacobLocke/Core-Scripts","forks_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/forks","keys_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/teams","hooks_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/hooks","issue_events_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/issues/events{/number}","events_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/events","assignees_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/assignees{/user}","branches_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/branches{/branch}","tags_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/tags","blobs_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/languages","stargazers_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/stargazers","contributors_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/contributors","subscribers_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/subscribers","subscription_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/subscription","commits_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/contents/{+path}","compare_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/merges","archive_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/downloads","issues_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/issues{/number}","pulls_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/labels{/name}","releases_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/releases{/id}","deployments_url":"https://api.github.com/repos/JacobLocke/Core-Scripts/deployments","created_at":"2016-06-13T21:13:58Z","updated_at":"2016-06-13T21:14:00Z","pushed_at":"2016-08-16T21:54:44Z","git_url":"git://github.com/JacobLocke/Core-Scripts.git","ssh_url":"git@github.com:JacobLocke/Core-Scripts.git","clone_url":"https://github.com/JacobLocke/Core-Scripts.git","svn_url":"https://github.com/JacobLocke/Core-Scripts","homepage":"","size":3151,"stargazers_count":0,"watchers_count":0,"language":"Lua","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ROBLOX:master","ref":"master","sha":"3780b7dbf8936c87938527cf9df6bd2a92642c0d","user":{"login":"ROBLOX","id":4195619,"avatar_url":"https://avatars.githubusercontent.com/u/4195619?v=3","gravatar_id":"","url":"https://api.github.com/users/ROBLOX","html_url":"https://github.com/ROBLOX","followers_url":"https://api.github.com/users/ROBLOX/followers","following_url":"https://api.github.com/users/ROBLOX/following{/other_user}","gists_url":"https://api.github.com/users/ROBLOX/gists{/gist_id}","starred_url":"https://api.github.com/users/ROBLOX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ROBLOX/subscriptions","organizations_url":"https://api.github.com/users/ROBLOX/orgs","repos_url":"https://api.github.com/users/ROBLOX/repos","events_url":"https://api.github.com/users/ROBLOX/events{/privacy}","received_events_url":"https://api.github.com/users/ROBLOX/received_events","type":"Organization","site_admin":false},"repo":{"id":19040095,"name":"Core-Scripts","full_name":"ROBLOX/Core-Scripts","owner":{"login":"ROBLOX","id":4195619,"avatar_url":"https://avatars.githubusercontent.com/u/4195619?v=3","gravatar_id":"","url":"https://api.github.com/users/ROBLOX","html_url":"https://github.com/ROBLOX","followers_url":"https://api.github.com/users/ROBLOX/followers","following_url":"https://api.github.com/users/ROBLOX/following{/other_user}","gists_url":"https://api.github.com/users/ROBLOX/gists{/gist_id}","starred_url":"https://api.github.com/users/ROBLOX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ROBLOX/subscriptions","organizations_url":"https://api.github.com/users/ROBLOX/orgs","repos_url":"https://api.github.com/users/ROBLOX/repos","events_url":"https://api.github.com/users/ROBLOX/events{/privacy}","received_events_url":"https://api.github.com/users/ROBLOX/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ROBLOX/Core-Scripts","description":"All of ROBLOX's core client scripts.","fork":false,"url":"https://api.github.com/repos/ROBLOX/Core-Scripts","forks_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/forks","keys_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/teams","hooks_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/hooks","issue_events_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/issues/events{/number}","events_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/events","assignees_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/assignees{/user}","branches_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/branches{/branch}","tags_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/tags","blobs_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/languages","stargazers_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/stargazers","contributors_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/contributors","subscribers_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/subscribers","subscription_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/subscription","commits_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/contents/{+path}","compare_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/merges","archive_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/downloads","issues_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/issues{/number}","pulls_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/labels{/name}","releases_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/releases{/id}","deployments_url":"https://api.github.com/repos/ROBLOX/Core-Scripts/deployments","created_at":"2014-04-22T18:02:17Z","updated_at":"2016-08-02T01:35:42Z","pushed_at":"2016-08-16T22:41:03Z","git_url":"git://github.com/ROBLOX/Core-Scripts.git","ssh_url":"git@github.com:ROBLOX/Core-Scripts.git","clone_url":"https://github.com/ROBLOX/Core-Scripts.git","svn_url":"https://github.com/ROBLOX/Core-Scripts","homepage":"","size":4088,"stargazers_count":55,"watchers_count":55,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":92,"mirror_url":null,"open_issues_count":26,"forks":92,"open_issues":26,"watchers":55,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/455"},"html":{"href":"https://github.com/ROBLOX/Core-Scripts/pull/455"},"issue":{"href":"https://api.github.com/repos/ROBLOX/Core-Scripts/issues/455"},"comments":{"href":"https://api.github.com/repos/ROBLOX/Core-Scripts/issues/455/comments"},"review_comments":{"href":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/455/comments"},"review_comment":{"href":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ROBLOX/Core-Scripts/pulls/455/commits"},"statuses":{"href":"https://api.github.com/repos/ROBLOX/Core-Scripts/statuses/d3a216f7aee96cbf07dcf9e6a5f7c5183ba022cc"}}}}
{"actor":{"display_login":"SolarCrane"}}