sergey.pozhidaev Posted February 17, 2014 Share Posted February 17, 2014 Hi! In your reference manual written that "run" function in Async class can runs the given function of a class. But I have an error in this case: class Bar { Bar(){} ~Bar(){} int foo() { log.message("foo was executed\n"); return 1; } }; void start_button_click() { Async async = new Async(); Bar br = new Bar(); async.run(br, "foo"); } Error: "Async::run(): unknown type of argument (Bar)" Am I doing something wrong? Link to comment
ivan.cuevas Posted February 17, 2014 Share Posted February 17, 2014 I didn't tested but I think function name must be the first parameter. Link to comment
sergey.pozhidaev Posted February 17, 2014 Author Share Posted February 17, 2014 int run (variable name,variable v0) Runs the given function with one argument or a member of a class in asynchronous way. Arguments variable name - Function to be run: string - function name, int - function ID, object - class name. variable v0 - If name is an object: class member name or ID; otherwise - function argument. And I tried to swap arguments, but it doesn't work too. Link to comment
ivan.cuevas Posted February 17, 2014 Share Posted February 17, 2014 You're right, looks like it works for external classes but not for user classes. As workaround, you can use a global function like: /* */ void callFoo(Bar br) { br.foo(); } /* */ void start_button_click() { Async async = new Async(); Bar br = new Bar(); async.run("callFoo", br, "foo"); } Link to comment
ulf.schroeter Posted February 17, 2014 Share Posted February 17, 2014 Are you using namespaces ? If so try specifying class name including namespace prefix. Maybe this helps Link to comment
sergey.pozhidaev Posted February 17, 2014 Author Share Posted February 17, 2014 ivan.cuevas, I already use this way =) Link to comment
sergey.pozhidaev Posted February 17, 2014 Author Share Posted February 17, 2014 ulf.schroeter, I don't use a namespace. Link to comment
silent Posted February 17, 2014 Share Posted February 17, 2014 Hi Sergey, Unfortunately, user classes is not supported in Async class. If it is acceptable to you, please use global function workaround. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
sergey.pozhidaev Posted February 17, 2014 Author Share Posted February 17, 2014 silent, ok. But if it possible, please, add support of user classes. It will be great =) Link to comment
Recommended Posts