{"action":"created","issue":{"url":"https://api.github.com/repos/svaarala/duktape/issues/333","labels_url":"https://api.github.com/repos/svaarala/duktape/issues/333/labels{/name}","comments_url":"https://api.github.com/repos/svaarala/duktape/issues/333/comments","events_url":"https://api.github.com/repos/svaarala/duktape/issues/333/events","html_url":"https://github.com/svaarala/duktape/issues/333","id":105714747,"number":333,"title":"Add duk_opt_boolean(), duk_opt_number(), etc optional getters","user":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/svaarala/duktape/labels/api","name":"api","color":"bfd4f2"},{"url":"https://api.github.com/repos/svaarala/duktape/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/svaarala/duktape/milestones/13","html_url":"https://github.com/svaarala/duktape/milestones/v1.4.0","labels_url":"https://api.github.com/repos/svaarala/duktape/milestones/13/labels","id":1225990,"number":13,"title":"v1.4.0","description":"TBD, parallel release to v2.0.0?","creator":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"open_issues":48,"closed_issues":0,"state":"open","created_at":"2015-07-26T04:06:08Z","updated_at":"2015-09-11T13:05:44Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-09-10T01:27:14Z","updated_at":"2015-09-11T14:29:30Z","closed_at":null,"body":"Return required value or user-specified default if index or type is invalid. Example:\r\n\r\n```c\r\nconst char *message = duk_opt_string(ctx, 3 /*idx*/, \"no message\" /*default_value*/);\r\n```\r\n\r\nEquivalent to:\r\n\r\n```c\r\nconst char *message;\r\nif (duk_is_string(ctx, 3)) {\r\n    message = duk_get_string(ctx, 3);\r\n} else {\r\n    message = \"no message\";\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/svaarala/duktape/issues/comments/139561160","html_url":"https://github.com/svaarala/duktape/issues/333#issuecomment-139561160","issue_url":"https://api.github.com/repos/svaarala/duktape/issues/333","id":139561160,"user":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"created_at":"2015-09-11T14:29:30Z","updated_at":"2015-09-11T14:29:30Z","body":"Hmm, by the way, the reason I wouldn't expect `duk_opt_string()` to throw a TypeError is probably that `duk_get_string()` doesn't do that either. And \"get string\" and \"get optional string\" are pretty close in my mind so I expect it to silently default - just like `duk_get_string()` silently defaults to NULL for every invalid type."}}