don't return friendslist; return either using cmd.user.pipe.sendRaw or cmd.sendResponse
On Jan 16, 12:46 pm, Micael Ribeiros <xtcp.m...@gmail.com> wrote: > Ive tried to delay the function like this but it didnt work: > > getFriends: function (uid) { > var friendslist = new Array(); > res = this.db.query('SELECT friendid FROM friends > WHERE userid=1', > function(res, errorNo) { > if (errorNo) { > return ['101', 'MYSQL_ERROR']; > } else { > //Here I can process the result but I > cant put the result for > example on friendslist like this: > for(var i = 0; i < res.length; i++) { > > friendslist.push(res[i].friendid); > } > } > return -1; > }); > Ape.log(friends.toSource()); //Here the friends Array > is still empty > as it was processed in the callback function or because when it > reaches here the callback function hasnt processed the results yet > return friendslist ; > }, -- You received this message because you are subscribed to the Google Groups "APE Project" group. To post to this group, send email to ape-project@googlegroups.com To unsubscribe from this group, send email to ape-project+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/ape-project?hl=en --- APE Project (Ajax Push Engine) Official website : http://www.ape-project.org/ Git Hub : http://github.com/APE-Project/