A
A
ArtificialLife2016-10-14 18:02:48
In contact with
ArtificialLife, 2016-10-14 18:02:48

Why is VKScript returning an empty result?

In the VK environment, everything works fine, as soon as I did not test the stored procedure. When called on the client - an empty result. That said, it doesn't look like the problem is with the client. If you write in the procedure: Expected, I will receive this list. The problem procedure itself:
return [1,2,3];

var q = Args.q;
var count = Args.count;

var groups = API.groups.search({
    "q": q,
    "count": count
});

var result = [];

if (groups.length == 0) {
    return [];
} else {
    // Все, что добавляется в results в этом цикле - не доступно при вызове. 
    // При чем, если вызывать процедуру в окружении ВК - все работает.
    var i = 0;
    while (i < groups.items.length) {
        var members = API.groups.getMembers({
            "group_id": groups.items[i].id,
            "count": 0
        }).count;
        result = result + [{
            "group": groups.items[i],
            "members": members
        }];
        i = i + 1;
    }
    return result;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Zhilyaev, 2016-10-14
@ArtificialLife

Most likely in the console (where the code is written) version 5.56 is used, and 3 is transmitted over HTTP. Add v=5.56 to the parameters

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question