{"action":"created","comment":{"url":"https://api.github.com/repos/openresty/lua-resty-core/pulls/comments/84976351","pull_request_review_id":5720040,"id":84976351,"diff_hunk":"@@ -0,0 +1,74 @@\n+-- Copyright (C) Thibault Charbonnier (thibaultcha)\n+-- I hereby assign copyright in this code to the lua-resty-core project,\n+-- to be licensed under the same terms as the rest of the code.\n+\n+\n+local base = require \"resty.core.base\"\n+local core_regex = require \"resty.core.regex\"\n+\n+\n+local re_match_helper = core_regex.re_match_helper\n+local tostring = tostring\n+local new_tab = base.new_tab\n+local sub = string.sub\n+\n+\n+local _M = { version = base.version }\n+\n+\n+function _M.split(subj, regex, opts, ctx, max, res)\n+    -- we need to cast this to strings to avoid exceptions when they are\n+    -- something else.\n+    -- needed because of further calls to string.sub in this function.\n+    subj = tostring(subj)\n+\n+    if not ctx then\n+        ctx = new_tab(0, 1)\n+    end\n+\n+    if not ctx.pos then\n+        ctx.pos = 1\n+    end\n+\n+    if not res then\n+        res = new_tab(0, 0)\n+    elseif type(res) ~= \"table\" then\n+        return error(\"res is not a table\", 2)\n+    end\n+\n+    local sub_idx = ctx.pos\n+    local res_idx = #res + 1","path":"lib/ngx/re.lua","position":40,"original_position":40,"commit_id":"2845b3d2efd563778bf7421284ca06debc4f5d4a","original_commit_id":"2845b3d2efd563778bf7421284ca06debc4f5d4a","user":{"login":"thibaultcha","id":1125431,"avatar_url":"https://avatars.githubusercontent.com/u/1125431?v=3","gravatar_id":"","url":"https://api.github.com/users/thibaultcha","html_url":"https://github.com/thibaultcha","followers_url":"https://api.github.com/users/thibaultcha/followers","following_url":"https://api.github.com/users/thibaultcha/following{/other_user}","gists_url":"https://api.github.com/users/thibaultcha/gists{/gist_id}","starred_url":"https://api.github.com/users/thibaultcha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thibaultcha/subscriptions","organizations_url":"https://api.github.com/users/thibaultcha/orgs","repos_url":"https://api.github.com/users/thibaultcha/repos","events_url":"https://api.github.com/users/thibaultcha/events{/privacy}","received_events_url":"https://api.github.com/users/thibaultcha/received_events","type":"User","site_admin":false},"body":"I thought it would be the user's responsibility to clear the table? One of the tests is even currently asserting this behavior. I'll clear it.","created_at":"2016-10-25T18:59:36Z","updated_at":"2016-10-25T18:59:36Z","html_url":"https://github.com/openresty/lua-resty-core/pull/66#discussion_r84976351","pull_request_url":"https://api.github.com/repos/openresty/lua-resty-core/pulls/66","_links":{"self":{"href":"https://api.github.com/repos/openresty/lua-resty-core/pulls/comments/84976351"},"html":{"href":"https://github.com/openresty/lua-resty-core/pull/66#discussion_r84976351"},"pull_request":{"href":"https://api.github.com/repos/openresty/lua-resty-core/pulls/66"}}},"pull_request":{"url":"https://api.github.com/repos/openresty/lua-resty-core/pulls/66","id":90469667,"html_url":"https://github.com/openresty/lua-resty-core/pull/66","diff_url":"https://github.com/openresty/lua-resty-core/pull/66.diff","patch_url":"https://github.com/openresty/lua-resty-core/pull/66.patch","issue_url":"https://api.github.com/repos/openresty/lua-resty-core/issues/66","number":66,"state":"open","locked":false,"title":"feat: implement 'ngx_re.split()'","user":{"login":"thibaultcha","id":1125431,"avatar_url":"https://avatars.githubusercontent.com/u/1125431?v=3","gravatar_id":"","url":"https://api.github.com/users/thibaultcha","html_url":"https://github.com/thibaultcha","followers_url":"https://api.github.com/users/thibaultcha/followers","following_url":"https://api.github.com/users/thibaultcha/following{/other_user}","gists_url":"https://api.github.com/users/thibaultcha/gists{/gist_id}","starred_url":"https://api.github.com/users/thibaultcha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thibaultcha/subscriptions","organizations_url":"https://api.github.com/users/thibaultcha/orgs","repos_url":"https://api.github.com/users/thibaultcha/repos","events_url":"https://api.github.com/users/thibaultcha/events{/privacy}","received_events_url":"https://api.github.com/users/thibaultcha/received_events","type":"User","site_admin":false},"body":"Hey @agentzh :)\r\n\r\nHad some time on my hands so here we go:\r\n\r\nImplement a new `ngx.re` module which implements the `split()` API\r\ndescribed at https://github.com/openresty/lua-nginx-module/issues/217\r\n\r\nLet me know what you think of this in general before polishing, and if this\r\nis good enough, I will write the documentation for it\r\n(I'd rather not write it until at least the API is approved).\r\n\r\nBest,","created_at":"2016-10-22T04:19:03Z","updated_at":"2016-10-25T18:59:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6ccb978081c5797475998fa09cb7a0879c6fe474","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openresty/lua-resty-core/pulls/66/commits","review_comments_url":"https://api.github.com/repos/openresty/lua-resty-core/pulls/66/comments","review_comment_url":"https://api.github.com/repos/openresty/lua-resty-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openresty/lua-resty-core/issues/66/comments","statuses_url":"https://api.github.com/repos/openresty/lua-resty-core/statuses/2845b3d2efd563778bf7421284ca06debc4f5d4a","head":{"label":"thibaultcha:feat/ngx_re_split","ref":"feat/ngx_re_split","sha":"2845b3d2efd563778bf7421284ca06debc4f5d4a","user":{"login":"thibaultcha","id":1125431,"avatar_url":"https://avatars.githubusercontent.com/u/1125431?v=3","gravatar_id":"","url":"https://api.github.com/users/thibaultcha","html_url":"https://github.com/thibaultcha","followers_url":"https://api.github.com/users/thibaultcha/followers","following_url":"https://api.github.com/users/thibaultcha/following{/other_user}","gists_url":"https://api.github.com/users/thibaultcha/gists{/gist_id}","starred_url":"https://api.github.com/users/thibaultcha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thibaultcha/subscriptions","organizations_url":"https://api.github.com/users/thibaultcha/orgs","repos_url":"https://api.github.com/users/thibaultcha/repos","events_url":"https://api.github.com/users/thibaultcha/events{/privacy}","received_events_url":"https://api.github.com/users/thibaultcha/received_events","type":"User","site_admin":false},"repo":{"id":71615802,"name":"lua-resty-core","full_name":"thibaultcha/lua-resty-core","owner":{"login":"thibaultcha","id":1125431,"avatar_url":"https://avatars.githubusercontent.com/u/1125431?v=3","gravatar_id":"","url":"https://api.github.com/users/thibaultcha","html_url":"https://github.com/thibaultcha","followers_url":"https://api.github.com/users/thibaultcha/followers","following_url":"https://api.github.com/users/thibaultcha/following{/other_user}","gists_url":"https://api.github.com/users/thibaultcha/gists{/gist_id}","starred_url":"https://api.github.com/users/thibaultcha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thibaultcha/subscriptions","organizations_url":"https://api.github.com/users/thibaultcha/orgs","repos_url":"https://api.github.com/users/thibaultcha/repos","events_url":"https://api.github.com/users/thibaultcha/events{/privacy}","received_events_url":"https://api.github.com/users/thibaultcha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thibaultcha/lua-resty-core","description":"New FFI-based API for lua-nginx-module","fork":true,"url":"https://api.github.com/repos/thibaultcha/lua-resty-core","forks_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/forks","keys_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/teams","hooks_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/hooks","issue_events_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/issues/events{/number}","events_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/events","assignees_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/assignees{/user}","branches_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/branches{/branch}","tags_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/tags","blobs_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/statuses/{sha}","languages_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/languages","stargazers_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/stargazers","contributors_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/contributors","subscribers_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/subscribers","subscription_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/subscription","commits_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/contents/{+path}","compare_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/merges","archive_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/downloads","issues_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/issues{/number}","pulls_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/pulls{/number}","milestones_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/milestones{/number}","notifications_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/labels{/name}","releases_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/releases{/id}","deployments_url":"https://api.github.com/repos/thibaultcha/lua-resty-core/deployments","created_at":"2016-10-22T04:04:12Z","updated_at":"2016-10-22T04:04:13Z","pushed_at":"2016-10-25T02:46:53Z","git_url":"git://github.com/thibaultcha/lua-resty-core.git","ssh_url":"git@github.com:thibaultcha/lua-resty-core.git","clone_url":"https://github.com/thibaultcha/lua-resty-core.git","svn_url":"https://github.com/thibaultcha/lua-resty-core","homepage":null,"size":427,"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":"openresty:master","ref":"master","sha":"bd7ab97a33627089f0a2d48d358228e02fde3c6c","user":{"login":"openresty","id":7390180,"avatar_url":"https://avatars.githubusercontent.com/u/7390180?v=3","gravatar_id":"","url":"https://api.github.com/users/openresty","html_url":"https://github.com/openresty","followers_url":"https://api.github.com/users/openresty/followers","following_url":"https://api.github.com/users/openresty/following{/other_user}","gists_url":"https://api.github.com/users/openresty/gists{/gist_id}","starred_url":"https://api.github.com/users/openresty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openresty/subscriptions","organizations_url":"https://api.github.com/users/openresty/orgs","repos_url":"https://api.github.com/users/openresty/repos","events_url":"https://api.github.com/users/openresty/events{/privacy}","received_events_url":"https://api.github.com/users/openresty/received_events","type":"Organization","site_admin":false},"repo":{"id":9782547,"name":"lua-resty-core","full_name":"openresty/lua-resty-core","owner":{"login":"openresty","id":7390180,"avatar_url":"https://avatars.githubusercontent.com/u/7390180?v=3","gravatar_id":"","url":"https://api.github.com/users/openresty","html_url":"https://github.com/openresty","followers_url":"https://api.github.com/users/openresty/followers","following_url":"https://api.github.com/users/openresty/following{/other_user}","gists_url":"https://api.github.com/users/openresty/gists{/gist_id}","starred_url":"https://api.github.com/users/openresty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openresty/subscriptions","organizations_url":"https://api.github.com/users/openresty/orgs","repos_url":"https://api.github.com/users/openresty/repos","events_url":"https://api.github.com/users/openresty/events{/privacy}","received_events_url":"https://api.github.com/users/openresty/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openresty/lua-resty-core","description":"New FFI-based API for lua-nginx-module","fork":false,"url":"https://api.github.com/repos/openresty/lua-resty-core","forks_url":"https://api.github.com/repos/openresty/lua-resty-core/forks","keys_url":"https://api.github.com/repos/openresty/lua-resty-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openresty/lua-resty-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openresty/lua-resty-core/teams","hooks_url":"https://api.github.com/repos/openresty/lua-resty-core/hooks","issue_events_url":"https://api.github.com/repos/openresty/lua-resty-core/issues/events{/number}","events_url":"https://api.github.com/repos/openresty/lua-resty-core/events","assignees_url":"https://api.github.com/repos/openresty/lua-resty-core/assignees{/user}","branches_url":"https://api.github.com/repos/openresty/lua-resty-core/branches{/branch}","tags_url":"https://api.github.com/repos/openresty/lua-resty-core/tags","blobs_url":"https://api.github.com/repos/openresty/lua-resty-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openresty/lua-resty-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openresty/lua-resty-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/openresty/lua-resty-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openresty/lua-resty-core/statuses/{sha}","languages_url":"https://api.github.com/repos/openresty/lua-resty-core/languages","stargazers_url":"https://api.github.com/repos/openresty/lua-resty-core/stargazers","contributors_url":"https://api.github.com/repos/openresty/lua-resty-core/contributors","subscribers_url":"https://api.github.com/repos/openresty/lua-resty-core/subscribers","subscription_url":"https://api.github.com/repos/openresty/lua-resty-core/subscription","commits_url":"https://api.github.com/repos/openresty/lua-resty-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/openresty/lua-resty-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/openresty/lua-resty-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/openresty/lua-resty-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/openresty/lua-resty-core/contents/{+path}","compare_url":"https://api.github.com/repos/openresty/lua-resty-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openresty/lua-resty-core/merges","archive_url":"https://api.github.com/repos/openresty/lua-resty-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openresty/lua-resty-core/downloads","issues_url":"https://api.github.com/repos/openresty/lua-resty-core/issues{/number}","pulls_url":"https://api.github.com/repos/openresty/lua-resty-core/pulls{/number}","milestones_url":"https://api.github.com/repos/openresty/lua-resty-core/milestones{/number}","notifications_url":"https://api.github.com/repos/openresty/lua-resty-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openresty/lua-resty-core/labels{/name}","releases_url":"https://api.github.com/repos/openresty/lua-resty-core/releases{/id}","deployments_url":"https://api.github.com/repos/openresty/lua-resty-core/deployments","created_at":"2013-04-30T23:53:32Z","updated_at":"2016-10-25T15:48:30Z","pushed_at":"2016-10-25T18:58:30Z","git_url":"git://github.com/openresty/lua-resty-core.git","ssh_url":"git@github.com:openresty/lua-resty-core.git","clone_url":"https://github.com/openresty/lua-resty-core.git","svn_url":"https://github.com/openresty/lua-resty-core","homepage":null,"size":539,"stargazers_count":186,"watchers_count":186,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":19,"forks":61,"open_issues":19,"watchers":186,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openresty/lua-resty-core/pulls/66"},"html":{"href":"https://github.com/openresty/lua-resty-core/pull/66"},"issue":{"href":"https://api.github.com/repos/openresty/lua-resty-core/issues/66"},"comments":{"href":"https://api.github.com/repos/openresty/lua-resty-core/issues/66/comments"},"review_comments":{"href":"https://api.github.com/repos/openresty/lua-resty-core/pulls/66/comments"},"review_comment":{"href":"https://api.github.com/repos/openresty/lua-resty-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openresty/lua-resty-core/pulls/66/commits"},"statuses":{"href":"https://api.github.com/repos/openresty/lua-resty-core/statuses/2845b3d2efd563778bf7421284ca06debc4f5d4a"}}}}
{"actor":{"display_login":"thibaultcha"}}