{"action":"created","issue":{"url":"https://api.github.com/repos/torch/argcheck/issues/12","repository_url":"https://api.github.com/repos/torch/argcheck","labels_url":"https://api.github.com/repos/torch/argcheck/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/torch/argcheck/issues/12/comments","events_url":"https://api.github.com/repos/torch/argcheck/issues/12/events","html_url":"https://github.com/torch/argcheck/issues/12","id":162990781,"number":12,"title":"Error message different from documentation","user":{"login":"Atcold","id":2119355,"avatar_url":"https://avatars.githubusercontent.com/u/2119355?v=3","gravatar_id":"","url":"https://api.github.com/users/Atcold","html_url":"https://github.com/Atcold","followers_url":"https://api.github.com/users/Atcold/followers","following_url":"https://api.github.com/users/Atcold/following{/other_user}","gists_url":"https://api.github.com/users/Atcold/gists{/gist_id}","starred_url":"https://api.github.com/users/Atcold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Atcold/subscriptions","organizations_url":"https://api.github.com/users/Atcold/orgs","repos_url":"https://api.github.com/users/Atcold/repos","events_url":"https://api.github.com/users/Atcold/events{/privacy}","received_events_url":"https://api.github.com/users/Atcold/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-29T18:09:59Z","updated_at":"2016-06-29T20:30:43Z","closed_at":null,"body":"In the documentation we have\r\n\r\n```lua\r\n> addfive('')\r\nstdin:2: invalid arguments\r\n\r\nThis function is going to do a simple addition.\r\nGive a number, it adds 5. Amazing.\r\n\r\narguments:\r\n{\r\n   [x = number]  -- the age of the captain [default=0]\r\n}\r\n```\r\n\r\nin my terminal I get\r\n\r\n```lua\r\nth> addfive('')\r\n[string \"argcheck\"]:49: \r\nThis function is going to do a simple addition. Give a number, it adds 5.\r\nAmazing.\r\n\r\nGot: string\r\ninvalid arguments!\r\nstack traceback:\r\n        [C]: in function 'error'\r\n        [string \"argcheck\"]:49: in function 'check'\r\n        [string \"function addfive(...)...\"]:2: in function 'addfive'\r\n        [string \"_RESULT={addfive('')}\"]:1: in main chunk\r\n        [C]: in function 'xpcall'\r\n        /Users/atcold/torch/install/share/lua/5.1/trepl/init.lua:651: in function 'repl'\r\n        ...cold/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk\r\n        [C]: at 0x010ca74630\r\n                                                                      [0.0009s]\r\n```\r\n\r\n 1. So, the last part, with the argument explanation, is missing.\r\n 2. Moreover, it looks like the `\\n` is ignored.\r\n\r\nAlso `? addfive` does not show the documentation. How do I get to see it?\r\n\r\nIn the same way, for the multi argument case, on the documentation it's shown that one may expect an explanation like the following\r\n\r\n```lua\r\narguments:\r\n{\r\n  [x   = number]  -- the age of the captain [default=0]\r\n   msg = string   -- a message\r\n}\r\n```\r\n\r\nwhere one knows that `msg` does not have any default value, but what I get instead is\r\n\r\n```lua\r\nGot: number\r\ninvalid arguments!\r\nstack traceback:\r\n        [C]: in function 'error'\r\n        [string \"argcheck\"]:74: in function 'check'\r\n        [string \"function addfive(...)...\"]:2: in function 'addfive'\r\n        [string \"_RESULT={addfive(4)}\"]:1: in main chunk\r\n        [C]: in function 'xpcall'\r\n        /Users/atcold/torch/install/share/lua/5.1/trepl/init.lua:651: in function 'repl'\r\n        ...cold/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk\r\n        [C]: at 0x010ca74630\r\n```"},"comment":{"url":"https://api.github.com/repos/torch/argcheck/issues/comments/229478714","html_url":"https://github.com/torch/argcheck/issues/12#issuecomment-229478714","issue_url":"https://api.github.com/repos/torch/argcheck/issues/12","id":229478714,"user":{"login":"Atcold","id":2119355,"avatar_url":"https://avatars.githubusercontent.com/u/2119355?v=3","gravatar_id":"","url":"https://api.github.com/users/Atcold","html_url":"https://github.com/Atcold","followers_url":"https://api.github.com/users/Atcold/followers","following_url":"https://api.github.com/users/Atcold/following{/other_user}","gists_url":"https://api.github.com/users/Atcold/gists{/gist_id}","starred_url":"https://api.github.com/users/Atcold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Atcold/subscriptions","organizations_url":"https://api.github.com/users/Atcold/orgs","repos_url":"https://api.github.com/users/Atcold/repos","events_url":"https://api.github.com/users/Atcold/events{/privacy}","received_events_url":"https://api.github.com/users/Atcold/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T20:30:43Z","updated_at":"2016-06-29T20:30:43Z","body":"OK, found the bug. It's about the `help` field. If it is not specified, everything works as expected\r\n\r\n```lua\r\nth> check = argcheck{                                                                                                             {name=\"x\", type=\"number\", default=0, help=\"the age of the captain\"},                                                           {name=\"msg\", type=\"string\", help=\"a message\"}                                                                               }                                                                                                                                                                                                    [0.0010s]\r\nth> check(4)                                                                                                                   [string \"argcheck\"]:74: \r\nArguments:\r\n\r\n({\r\n  [x   = number]  -- the age of the captain [default=0]\r\n   msg = string   -- a message\r\n})\r\n\r\n\r\nGot: number\r\ninvalid arguments!\r\nstack traceback:\r\n        [C]: in function 'error'\r\n        [string \"argcheck\"]:74: in function 'check'\r\n        [string \"_RESULT={check(4)}\"]:1: in main chunk\r\n        [C]: in function 'xpcall'\r\n        /Users/atcold/torch/install/share/lua/5.1/trepl/init.lua:651: in function 'repl'\r\n        ...cold/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk\r\n        [C]: at 0x010ca74630\r\n                                                                      [0.0005s]\r\n```\r\n\r\nIf it is specified, then it breaks without knowledge of what went wrong\r\n\r\n```lua\r\nth> check = argcheck{                                                                                                             help=[[                                                                                                                     This function is going to do a simple addition.                                                                                Give a number, it adds 5. Amazing.                                                                                             ]],                                                                                                                               {name=\"x\", type=\"number\", default=0, help=\"the age of the captain\"},                                                           {name=\"msg\", type=\"string\", help=\"a message\"}                                                                               }\r\n                                                                      [0.0012s]\r\nth> check(4)                                                                                                                   [string \"argcheck\"]:74: \r\nThis function is going to do a simple addition. Give a number, it adds 5.\r\nAmazing.\r\n\r\nGot: number\r\ninvalid arguments!\r\nstack traceback:\r\n        [C]: in function 'error'\r\n        [string \"argcheck\"]:74: in function 'check'\r\n        [string \"_RESULT={check(4)}\"]:1: in main chunk\r\n        [C]: in function 'xpcall'\r\n        /Users/atcold/torch/install/share/lua/5.1/trepl/init.lua:651: in function 'repl'\r\n        ...cold/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk\r\n        [C]: at 0x010ca74630\r\n                                                                      [0.0006s]\r\n```"}}
{"actor":{"display_login":"Atcold"}}