{"action":"created","issue":{"url":"https://api.github.com/repos/eliasdaler/MetaStuff/issues/20","repository_url":"https://api.github.com/repos/eliasdaler/MetaStuff","labels_url":"https://api.github.com/repos/eliasdaler/MetaStuff/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/eliasdaler/MetaStuff/issues/20/comments","events_url":"https://api.github.com/repos/eliasdaler/MetaStuff/issues/20/events","html_url":"https://github.com/eliasdaler/MetaStuff/issues/20","id":326734811,"number":20,"title":"Support for methods","user":{"login":"Nightmare82","id":1686526,"avatar_url":"https://avatars3.githubusercontent.com/u/1686526?v=4","gravatar_id":"","url":"https://api.github.com/users/Nightmare82","html_url":"https://github.com/Nightmare82","followers_url":"https://api.github.com/users/Nightmare82/followers","following_url":"https://api.github.com/users/Nightmare82/following{/other_user}","gists_url":"https://api.github.com/users/Nightmare82/gists{/gist_id}","starred_url":"https://api.github.com/users/Nightmare82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nightmare82/subscriptions","organizations_url":"https://api.github.com/users/Nightmare82/orgs","repos_url":"https://api.github.com/users/Nightmare82/repos","events_url":"https://api.github.com/users/Nightmare82/events{/privacy}","received_events_url":"https://api.github.com/users/Nightmare82/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-26T12:31:11Z","updated_at":"2018-05-26T12:59:04Z","closed_at":null,"author_association":"NONE","body":"One thing that would be nice is to have the possibility to define methods that can afterwards be called using your library. A use case for that is that developers can define methods than can be called via GUI in a game editor, for example functions like \"Reset\" for a component.\r\n\r\nI tried to use the existing mechanics but it crashes when trying to call the method:\r\n\r\nStruct Test\r\n{\r\n  void test(int parameter) { std::cout << \"Called test with parameter: \" << parameter << std::endl;\r\n}:\r\n\r\nnamespace meta\r\n{\r\n    template <>\r\n    inline auto registerMembers<Test>()\r\n    {\r\n        return members(member(\"test\", &Test::test));\r\n    }\r\n}\r\n\r\nTest testObject;\r\nmeta::setMemberValue<Test>(testObject, \"test\", 12);\r\n\r\nI think ideally it would work similar as members, e.g. :\r\n\r\nnamespace meta\r\n{\r\n    template <>\r\n    inline auto registerMembers<Test>()\r\n    {\r\n        return members(method(\"test\", &Test::test),member(\"x\", &Test::getX));\r\n    }\r\n}\r\n\r\nTest testObject;\r\nmeta::callMethod<Test>(testObject, \"test\", 12);\r\n\r\nWhat do you think ?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/eliasdaler/MetaStuff/issues/comments/392259844","html_url":"https://github.com/eliasdaler/MetaStuff/issues/20#issuecomment-392259844","issue_url":"https://api.github.com/repos/eliasdaler/MetaStuff/issues/20","id":392259844,"user":{"login":"Nightmare82","id":1686526,"avatar_url":"https://avatars3.githubusercontent.com/u/1686526?v=4","gravatar_id":"","url":"https://api.github.com/users/Nightmare82","html_url":"https://github.com/Nightmare82","followers_url":"https://api.github.com/users/Nightmare82/followers","following_url":"https://api.github.com/users/Nightmare82/following{/other_user}","gists_url":"https://api.github.com/users/Nightmare82/gists{/gist_id}","starred_url":"https://api.github.com/users/Nightmare82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nightmare82/subscriptions","organizations_url":"https://api.github.com/users/Nightmare82/orgs","repos_url":"https://api.github.com/users/Nightmare82/repos","events_url":"https://api.github.com/users/Nightmare82/events{/privacy}","received_events_url":"https://api.github.com/users/Nightmare82/received_events","type":"User","site_admin":false},"created_at":"2018-05-26T12:59:04Z","updated_at":"2018-05-26T12:59:04Z","author_association":"NONE","body":"Oh, I just found out it is working already with members, I just used the wrong template parameter :-)\r\n\r\nThis is the working version:\r\nStruct Test\r\n{\r\nvoid test(int parameter) { std::cout << \"Called test with parameter: \" << parameter << std::endl;\r\n}:\r\n\r\nnamespace meta\r\n{\r\ntemplate <>\r\ninline auto registerMembers()\r\n{\r\nreturn members(member(\"test\", &Test::test));\r\n}\r\n}\r\n\r\nTest testObject;\r\nmeta::setMemberValue<int>(testObject, \"test\", 12);"}}
{"actor":{"display_login":"Nightmare82"}}