{"action":"created","issue":{"url":"https://api.github.com/repos/svaarala/duktape/issues/416","labels_url":"https://api.github.com/repos/svaarala/duktape/issues/416/labels{/name}","comments_url":"https://api.github.com/repos/svaarala/duktape/issues/416/comments","events_url":"https://api.github.com/repos/svaarala/duktape/issues/416/events","html_url":"https://github.com/svaarala/duktape/issues/416","id":113788422,"number":416,"title":"Interpret parameters as objects","user":{"login":"BorisFaz","id":15359727,"avatar_url":"https://avatars.githubusercontent.com/u/15359727?v=3","gravatar_id":"","url":"https://api.github.com/users/BorisFaz","html_url":"https://github.com/BorisFaz","followers_url":"https://api.github.com/users/BorisFaz/followers","following_url":"https://api.github.com/users/BorisFaz/following{/other_user}","gists_url":"https://api.github.com/users/BorisFaz/gists{/gist_id}","starred_url":"https://api.github.com/users/BorisFaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BorisFaz/subscriptions","organizations_url":"https://api.github.com/users/BorisFaz/orgs","repos_url":"https://api.github.com/users/BorisFaz/repos","events_url":"https://api.github.com/users/BorisFaz/events{/privacy}","received_events_url":"https://api.github.com/users/BorisFaz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-28T10:34:40Z","updated_at":"2015-10-28T10:44:22Z","closed_at":null,"body":"Hello. I'm moving my first steps into duktape. One thing i really don't understand is how to get and interpret a function parameter as object. I mean the right JS-duktape object.\r\nI created the classical Point constructor as done into different code examples. what i need is how to get and interpret a Point object passed as parameter into a function.\r\nExample:\r\nduk_ret_t examinate_point(duk_context *ctx)\r\n{\r\n\t// Get arguments\r\n\tint res   = duk_is_object(ctx,1);\r\n\tint res2 = duk_is_pointer(ctx, 1);\r\n// Here is  something like \"duk_to_pointer(ctx, 0)\"\r\n// i mean, use a kind of \"duk_to_object(ctx, 1)\" but getting the object\r\n}\r\n\r\n\r\nduk_to_pointer, duk_to_number they give back something but duk_to_object not.\r\nIs there sample code, or explanation in how to solve this problem?\r\nThank you. :-)"},"comment":{"url":"https://api.github.com/repos/svaarala/duktape/issues/comments/151797534","html_url":"https://github.com/svaarala/duktape/issues/416#issuecomment-151797534","issue_url":"https://api.github.com/repos/svaarala/duktape/issues/416","id":151797534,"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-10-28T10:44:22Z","updated_at":"2015-10-28T10:44:22Z","body":"The object is already on the value stack - there's no way to \"get an object\" as such from C code, because there's no easy way to represent an object as a C value.\r\n\r\nInstead, you can read and write properties of the object, e.g.:\r\n\r\n```\r\nduk_get_prop_string(ctx, 0, \"xCoord\");\r\nprintf(\"x-coordinate is: %d\\n\", (int) duk_to_int(ctx, -1));\r\nduk_pop(ctx);\r\n```"}}