{"action":"created","comment":{"url":"https://api.github.com/repos/pygy/require.lua/pulls/comments/36285510","id":36285510,"diff_hunk":"@@ -8,25 +8,25 @@ local t_concat = table.concat\n \n --- Helpers\n \n-local function _tostring(s) return \"\"..s end\n-\n local function checkstring(s)\n-    local success, res = pcall(_tostring, s)\n-    if success then return res end\n-    error(\"bad argument #1 to 'require' (string expected, got \"..type(s)..\")\", 3)\n+    s = type(s) == \"number\" and tostring(s) or s -- support numerical module name\n+    if type(s) ~= \"string\" then\n+        error(\"bad argument #1 to 'require' (string expected, got \"..type(s)..\")\", 3)\n+    end\n+    return s\n end\n \n --- for Lua 5.1\n \n local package, p_loaded = package, package.loaded\n \n-local sentinel = newproxy and newproxy() or string.char(1,2,3,4,5)\n+local sentinel = {} --newproxy and newproxy() or string.char(1,2,3,4,5)\n \n local function require51 (name)\n-    name = checkstring(name)\n     if p_loaded[name] == sentinel then\n         error(\"loop or previous error loading module '\"..name..\"'\", 2)\n     end\n+    name = checkstring(name)","path":"require.lua","position":29,"original_position":29,"commit_id":"a98493e4f5281ef86fbe0f95424ea987cc9499c5","original_commit_id":"a98493e4f5281ef86fbe0f95424ea987cc9499c5","user":{"login":"tst2005","id":1117821,"avatar_url":"https://avatars.githubusercontent.com/u/1117821?v=3","gravatar_id":"","url":"https://api.github.com/users/tst2005","html_url":"https://github.com/tst2005","followers_url":"https://api.github.com/users/tst2005/followers","following_url":"https://api.github.com/users/tst2005/following{/other_user}","gists_url":"https://api.github.com/users/tst2005/gists{/gist_id}","starred_url":"https://api.github.com/users/tst2005/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tst2005/subscriptions","organizations_url":"https://api.github.com/users/tst2005/orgs","repos_url":"https://api.github.com/users/tst2005/repos","events_url":"https://api.github.com/users/tst2005/events{/privacy}","received_events_url":"https://api.github.com/users/tst2005/received_events","type":"User","site_admin":false},"body":"Exact!","created_at":"2015-08-05T09:51:18Z","updated_at":"2015-08-05T09:51:18Z","html_url":"https://github.com/pygy/require.lua/pull/3#discussion_r36285510","pull_request_url":"https://api.github.com/repos/pygy/require.lua/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/pygy/require.lua/pulls/comments/36285510"},"html":{"href":"https://github.com/pygy/require.lua/pull/3#discussion_r36285510"},"pull_request":{"href":"https://api.github.com/repos/pygy/require.lua/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/pygy/require.lua/pulls/3","id":41597821,"html_url":"https://github.com/pygy/require.lua/pull/3","diff_url":"https://github.com/pygy/require.lua/pull/3.diff","patch_url":"https://github.com/pygy/require.lua/pull/3.patch","issue_url":"https://api.github.com/repos/pygy/require.lua/issues/3","number":3,"state":"open","locked":false,"title":"use a table as sentinel value ; check the type of module name argument","user":{"login":"tst2005","id":1117821,"avatar_url":"https://avatars.githubusercontent.com/u/1117821?v=3","gravatar_id":"","url":"https://api.github.com/users/tst2005","html_url":"https://github.com/tst2005","followers_url":"https://api.github.com/users/tst2005/followers","following_url":"https://api.github.com/users/tst2005/following{/other_user}","gists_url":"https://api.github.com/users/tst2005/gists{/gist_id}","starred_url":"https://api.github.com/users/tst2005/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tst2005/subscriptions","organizations_url":"https://api.github.com/users/tst2005/orgs","repos_url":"https://api.github.com/users/tst2005/repos","events_url":"https://api.github.com/users/tst2005/events{/privacy}","received_events_url":"https://api.github.com/users/tst2005/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-04T17:53:19Z","updated_at":"2015-08-05T09:51:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e585ab9c07d0381b9bf803aa3f9aa00372361dc0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pygy/require.lua/pulls/3/commits","review_comments_url":"https://api.github.com/repos/pygy/require.lua/pulls/3/comments","review_comment_url":"https://api.github.com/repos/pygy/require.lua/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pygy/require.lua/issues/3/comments","statuses_url":"https://api.github.com/repos/pygy/require.lua/statuses/a98493e4f5281ef86fbe0f95424ea987cc9499c5","head":{"label":"tst2005:master","ref":"master","sha":"a98493e4f5281ef86fbe0f95424ea987cc9499c5","user":{"login":"tst2005","id":1117821,"avatar_url":"https://avatars.githubusercontent.com/u/1117821?v=3","gravatar_id":"","url":"https://api.github.com/users/tst2005","html_url":"https://github.com/tst2005","followers_url":"https://api.github.com/users/tst2005/followers","following_url":"https://api.github.com/users/tst2005/following{/other_user}","gists_url":"https://api.github.com/users/tst2005/gists{/gist_id}","starred_url":"https://api.github.com/users/tst2005/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tst2005/subscriptions","organizations_url":"https://api.github.com/users/tst2005/orgs","repos_url":"https://api.github.com/users/tst2005/repos","events_url":"https://api.github.com/users/tst2005/events{/privacy}","received_events_url":"https://api.github.com/users/tst2005/received_events","type":"User","site_admin":false},"repo":{"id":32867500,"name":"lua-require","full_name":"tst2005/lua-require","owner":{"login":"tst2005","id":1117821,"avatar_url":"https://avatars.githubusercontent.com/u/1117821?v=3","gravatar_id":"","url":"https://api.github.com/users/tst2005","html_url":"https://github.com/tst2005","followers_url":"https://api.github.com/users/tst2005/followers","following_url":"https://api.github.com/users/tst2005/following{/other_user}","gists_url":"https://api.github.com/users/tst2005/gists{/gist_id}","starred_url":"https://api.github.com/users/tst2005/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tst2005/subscriptions","organizations_url":"https://api.github.com/users/tst2005/orgs","repos_url":"https://api.github.com/users/tst2005/repos","events_url":"https://api.github.com/users/tst2005/events{/privacy}","received_events_url":"https://api.github.com/users/tst2005/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tst2005/lua-require","description":"`require()` rewritten in plain Lua","fork":true,"url":"https://api.github.com/repos/tst2005/lua-require","forks_url":"https://api.github.com/repos/tst2005/lua-require/forks","keys_url":"https://api.github.com/repos/tst2005/lua-require/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tst2005/lua-require/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tst2005/lua-require/teams","hooks_url":"https://api.github.com/repos/tst2005/lua-require/hooks","issue_events_url":"https://api.github.com/repos/tst2005/lua-require/issues/events{/number}","events_url":"https://api.github.com/repos/tst2005/lua-require/events","assignees_url":"https://api.github.com/repos/tst2005/lua-require/assignees{/user}","branches_url":"https://api.github.com/repos/tst2005/lua-require/branches{/branch}","tags_url":"https://api.github.com/repos/tst2005/lua-require/tags","blobs_url":"https://api.github.com/repos/tst2005/lua-require/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tst2005/lua-require/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tst2005/lua-require/git/refs{/sha}","trees_url":"https://api.github.com/repos/tst2005/lua-require/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tst2005/lua-require/statuses/{sha}","languages_url":"https://api.github.com/repos/tst2005/lua-require/languages","stargazers_url":"https://api.github.com/repos/tst2005/lua-require/stargazers","contributors_url":"https://api.github.com/repos/tst2005/lua-require/contributors","subscribers_url":"https://api.github.com/repos/tst2005/lua-require/subscribers","subscription_url":"https://api.github.com/repos/tst2005/lua-require/subscription","commits_url":"https://api.github.com/repos/tst2005/lua-require/commits{/sha}","git_commits_url":"https://api.github.com/repos/tst2005/lua-require/git/commits{/sha}","comments_url":"https://api.github.com/repos/tst2005/lua-require/comments{/number}","issue_comment_url":"https://api.github.com/repos/tst2005/lua-require/issues/comments{/number}","contents_url":"https://api.github.com/repos/tst2005/lua-require/contents/{+path}","compare_url":"https://api.github.com/repos/tst2005/lua-require/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tst2005/lua-require/merges","archive_url":"https://api.github.com/repos/tst2005/lua-require/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tst2005/lua-require/downloads","issues_url":"https://api.github.com/repos/tst2005/lua-require/issues{/number}","pulls_url":"https://api.github.com/repos/tst2005/lua-require/pulls{/number}","milestones_url":"https://api.github.com/repos/tst2005/lua-require/milestones{/number}","notifications_url":"https://api.github.com/repos/tst2005/lua-require/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tst2005/lua-require/labels{/name}","releases_url":"https://api.github.com/repos/tst2005/lua-require/releases{/id}","created_at":"2015-03-25T13:51:16Z","updated_at":"2015-08-04T15:59:33Z","pushed_at":"2015-08-05T09:49:59Z","git_url":"git://github.com/tst2005/lua-require.git","ssh_url":"git@github.com:tst2005/lua-require.git","clone_url":"https://github.com/tst2005/lua-require.git","svn_url":"https://github.com/tst2005/lua-require","homepage":null,"size":89,"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":"pygy:master","ref":"master","sha":"91d8650ae7a304110019c2276a637502fcfb7cba","user":{"login":"pygy","id":54515,"avatar_url":"https://avatars.githubusercontent.com/u/54515?v=3","gravatar_id":"","url":"https://api.github.com/users/pygy","html_url":"https://github.com/pygy","followers_url":"https://api.github.com/users/pygy/followers","following_url":"https://api.github.com/users/pygy/following{/other_user}","gists_url":"https://api.github.com/users/pygy/gists{/gist_id}","starred_url":"https://api.github.com/users/pygy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pygy/subscriptions","organizations_url":"https://api.github.com/users/pygy/orgs","repos_url":"https://api.github.com/users/pygy/repos","events_url":"https://api.github.com/users/pygy/events{/privacy}","received_events_url":"https://api.github.com/users/pygy/received_events","type":"User","site_admin":false},"repo":{"id":21185219,"name":"require.lua","full_name":"pygy/require.lua","owner":{"login":"pygy","id":54515,"avatar_url":"https://avatars.githubusercontent.com/u/54515?v=3","gravatar_id":"","url":"https://api.github.com/users/pygy","html_url":"https://github.com/pygy","followers_url":"https://api.github.com/users/pygy/followers","following_url":"https://api.github.com/users/pygy/following{/other_user}","gists_url":"https://api.github.com/users/pygy/gists{/gist_id}","starred_url":"https://api.github.com/users/pygy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pygy/subscriptions","organizations_url":"https://api.github.com/users/pygy/orgs","repos_url":"https://api.github.com/users/pygy/repos","events_url":"https://api.github.com/users/pygy/events{/privacy}","received_events_url":"https://api.github.com/users/pygy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pygy/require.lua","description":"`require()` rewritten in plain Lua","fork":false,"url":"https://api.github.com/repos/pygy/require.lua","forks_url":"https://api.github.com/repos/pygy/require.lua/forks","keys_url":"https://api.github.com/repos/pygy/require.lua/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pygy/require.lua/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pygy/require.lua/teams","hooks_url":"https://api.github.com/repos/pygy/require.lua/hooks","issue_events_url":"https://api.github.com/repos/pygy/require.lua/issues/events{/number}","events_url":"https://api.github.com/repos/pygy/require.lua/events","assignees_url":"https://api.github.com/repos/pygy/require.lua/assignees{/user}","branches_url":"https://api.github.com/repos/pygy/require.lua/branches{/branch}","tags_url":"https://api.github.com/repos/pygy/require.lua/tags","blobs_url":"https://api.github.com/repos/pygy/require.lua/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pygy/require.lua/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pygy/require.lua/git/refs{/sha}","trees_url":"https://api.github.com/repos/pygy/require.lua/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pygy/require.lua/statuses/{sha}","languages_url":"https://api.github.com/repos/pygy/require.lua/languages","stargazers_url":"https://api.github.com/repos/pygy/require.lua/stargazers","contributors_url":"https://api.github.com/repos/pygy/require.lua/contributors","subscribers_url":"https://api.github.com/repos/pygy/require.lua/subscribers","subscription_url":"https://api.github.com/repos/pygy/require.lua/subscription","commits_url":"https://api.github.com/repos/pygy/require.lua/commits{/sha}","git_commits_url":"https://api.github.com/repos/pygy/require.lua/git/commits{/sha}","comments_url":"https://api.github.com/repos/pygy/require.lua/comments{/number}","issue_comment_url":"https://api.github.com/repos/pygy/require.lua/issues/comments{/number}","contents_url":"https://api.github.com/repos/pygy/require.lua/contents/{+path}","compare_url":"https://api.github.com/repos/pygy/require.lua/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pygy/require.lua/merges","archive_url":"https://api.github.com/repos/pygy/require.lua/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pygy/require.lua/downloads","issues_url":"https://api.github.com/repos/pygy/require.lua/issues{/number}","pulls_url":"https://api.github.com/repos/pygy/require.lua/pulls{/number}","milestones_url":"https://api.github.com/repos/pygy/require.lua/milestones{/number}","notifications_url":"https://api.github.com/repos/pygy/require.lua/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pygy/require.lua/labels{/name}","releases_url":"https://api.github.com/repos/pygy/require.lua/releases{/id}","created_at":"2014-06-25T00:32:34Z","updated_at":"2015-08-04T21:27:55Z","pushed_at":"2015-08-04T22:55:47Z","git_url":"git://github.com/pygy/require.lua.git","ssh_url":"git@github.com:pygy/require.lua.git","clone_url":"https://github.com/pygy/require.lua.git","svn_url":"https://github.com/pygy/require.lua","homepage":null,"size":248,"stargazers_count":15,"watchers_count":15,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pygy/require.lua/pulls/3"},"html":{"href":"https://github.com/pygy/require.lua/pull/3"},"issue":{"href":"https://api.github.com/repos/pygy/require.lua/issues/3"},"comments":{"href":"https://api.github.com/repos/pygy/require.lua/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/pygy/require.lua/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/pygy/require.lua/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pygy/require.lua/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/pygy/require.lua/statuses/a98493e4f5281ef86fbe0f95424ea987cc9499c5"}}}}