Page 1 of 1
is room.getAllUsers() broken ?
Posted: 17 Apr 2019, 11:34
by MaHoNe
hello
when i use room.getAllUsers() The list comes in this way :
Code: Select all
[Lit.gotoandplay.smartfoxserver.data.User;@4caec9
The code must be :
Code: Select all
[it.gotoandplay.smartfoxserver.data.User@4caec9]
I also tried
room.getUserList()
And gave me the following :
ps : zone.getAllUsers() works well
and i use SFS PRO 1.6.20
Re: is room.getAllUsers() broken ?
Posted: 17 Apr 2019, 12:10
by Lapo
Hi,
Room.getAllUsers() returns an User[], in other words an array with User objects in it.
It's not clear what the problem are you having or what you're expecting instead.
Can you clarify?
Thanks.
Re: is room.getAllUsers() broken ?
Posted: 17 Apr 2019, 13:13
by MaHoNe
room.getAllUsers() retuns that way :
Code: Select all
[Lit.gotoandplay.smartfoxserver.data.User;@4caec9
When I try :
Code: Select all
var users = rooom.getAllUsers()
for (var i = 0; i < users.size(); i++)
{
// code
// code
}
i get
Code: Select all
13:14:10.870 - [ WARNING ] > Error in extension [ games.as ]: Java class "[Lit.gotoandplay.smartfoxserver.data.User;" has no public instance field or method named "size". (games.as#1659) Internal: 84 -- Line number: 83 in file: games.as
Re: is room.getAllUsers() broken ?
Posted: 17 Apr 2019, 13:19
by Lapo
The method returns a Java array, not a collection. Java arrays don't expose a method called size()
To obtain the size of the array you can check the array.length property, like in Javascript.
Hope it helps
Re: is room.getAllUsers() broken ?
Posted: 17 Apr 2019, 13:53
by MaHoNe
you are right lapo thanks