help with getUserList() please

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

alex2344
Posts: 15
Joined: 30 Oct 2018, 12:04

help with getUserList() please

Postby alex2344 » 28 Nov 2018, 20:53

:D :D
Last edited by alex2344 on 29 Jun 2019, 20:07, edited 1 time in total.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: help with getUserList() please

Postby Lapo » 29 Nov 2018, 14:36

The userList variable is already an array so you don't need to wrap it in another array.
Your code:

Code: Select all

_server.sendResponse(res, -1, null, [userList]);


Correct code:

Code: Select all

_server.sendResponse(res, -1, null, userList);


Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
alex2344
Posts: 15
Joined: 30 Oct 2018, 12:04

Re: help with getUserList() please

Postby alex2344 » 29 Nov 2018, 18:50

thank you for replying
When I use :

Code: Select all

_server.sendResponse(res, -1, null, userList);


I get the following error

Code: Select all

18:50:33.244 - [ WARNING ] > Error in extension [ admin.as ]: Wrapped java.lang.ClassCastException: java.util.LinkedList cannot be cast to java.nio.channels.SocketChannel (admin.as#513) Internal: -1062 -- Line number:  (MainLib line: 513)
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: help with getUserList() please

Postby Lapo » 30 Nov 2018, 11:46

Sorry, my bad, haven't been using SFS1 in a long time.
The sendResponse method expects a native array but the getUserList() returns a Java list.

You can use a for loop to transform it and transfer all elements into a native AS array.
Lapo

--

gotoAndPlay()

...addicted to flash games
alex2344
Posts: 15
Joined: 30 Oct 2018, 12:04

Re: help with getUserList() please

Postby alex2344 » 30 Nov 2018, 14:54

It works now thanks

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 35 guests