{"action":"created","issue":{"url":"https://api.github.com/repos/scijs/cwise/issues/6","labels_url":"https://api.github.com/repos/scijs/cwise/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/scijs/cwise/issues/6/comments","events_url":"https://api.github.com/repos/scijs/cwise/issues/6/events","html_url":"https://github.com/scijs/cwise/issues/6","id":93316047,"number":6,"title":"Can't access RGB triplet with blockIndices","user":{"login":"thibauts","id":2544184,"avatar_url":"https://avatars.githubusercontent.com/u/2544184?v=3","gravatar_id":"","url":"https://api.github.com/users/thibauts","html_url":"https://github.com/thibauts","followers_url":"https://api.github.com/users/thibauts/followers","following_url":"https://api.github.com/users/thibauts/following{/other_user}","gists_url":"https://api.github.com/users/thibauts/gists{/gist_id}","starred_url":"https://api.github.com/users/thibauts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thibauts/subscriptions","organizations_url":"https://api.github.com/users/thibauts/orgs","repos_url":"https://api.github.com/users/thibauts/repos","events_url":"https://api.github.com/users/thibauts/events{/privacy}","received_events_url":"https://api.github.com/users/thibauts/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-06T16:05:04Z","updated_at":"2015-07-06T16:37:01Z","closed_at":null,"body":"I'm trying to process an image and need to access the full RGB triplet on each loop.\r\n\r\n```javascript\r\nvar myop = cwise({\r\n  args: [{ blockIndices: -1 }, 'scalar'],\r\n  body: function(rgb, s) {\r\n      console.log(rgb[0], rgb[1], rgb[2]); // <= this works\r\n      console.log(rgb); // <= this doesn't\r\n    }\r\n  }\r\n});\r\n```\r\n\r\nThe error I get is `Uncaught ReferenceError: _inline_1_arg0_ is not defined`.\r\n\r\nping @jaspervdg"},"comment":{"url":"https://api.github.com/repos/scijs/cwise/issues/comments/118919317","html_url":"https://github.com/scijs/cwise/issues/6#issuecomment-118919317","issue_url":"https://api.github.com/repos/scijs/cwise/issues/6","id":118919317,"user":{"login":"rreusser","id":572717,"avatar_url":"https://avatars.githubusercontent.com/u/572717?v=3","gravatar_id":"","url":"https://api.github.com/users/rreusser","html_url":"https://github.com/rreusser","followers_url":"https://api.github.com/users/rreusser/followers","following_url":"https://api.github.com/users/rreusser/following{/other_user}","gists_url":"https://api.github.com/users/rreusser/gists{/gist_id}","starred_url":"https://api.github.com/users/rreusser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rreusser/subscriptions","organizations_url":"https://api.github.com/users/rreusser/orgs","repos_url":"https://api.github.com/users/rreusser/repos","events_url":"https://api.github.com/users/rreusser/events{/privacy}","received_events_url":"https://api.github.com/users/rreusser/received_events","type":"User","site_admin":false},"created_at":"2015-07-06T16:37:01Z","updated_at":"2015-07-06T16:37:01Z","body":"To rephrase more to the point: There's no native javascript construct (yet?) for slicing and passing around the components in the way you're describing. If what you're trying to do is overwrite the components via a function (just guessing), then I think you'll either have to inline the function into `body` and set them (e.g. `rgb[0] = 128` and then let cwise take it from there) or you'll have to return the answer from a function and then reassign them, which would work but is maybe not optimal, depending on what the js engine actually does with this, e.g.:\r\n\r\n```javascript\r\nbody: function(rgb) {\r\n  var rgbDark = darken(rgb[0], rgb[1], rgb[2])\r\n  rgb[0] = rgbDark[0]\r\n  rgb[1] = rgbDark[1]\r\n  rgb[2] = rgbDark[2]\r\n}\r\n```"}}