Undefined items server side??

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

Moderators: Lapo, Bax

Posts: 57
Joined: 07 Jul 2007, 10:24

Undefined items server side??

Postby poppop » 19 May 2008, 20:46

Hi again,

I'm trying to use an array and objects on the server side, but it dosnt like it when somthing is undefined.

I have this:

Code: Select all

var allZones = null
var userLists = null
function init()
   allZones = new Array;
   userLists = new Array;

function handleRequest(cmd, params, user, fromRoom)

         if(allZones[7].userLists == undefined){
            allZones[7] = ({userLists: "Hello"})


I get the following error message in the server output:

Error in extension: TypeError: cannot read property "userLists" from undefined Internal 140

I think its because allZones[7].userLists is undefined when its first run -- but thats the point of the == undefined thing.

If i set it in the init() function:

allZones[7] = ({userLists: "Hello"})

It works fine.

Trouble is, i cannot possibly make all "allZones[]" as they may not all be needed and there will be 1000's.

Any help on allowing the undefined check to work server side?


Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 7 guests