delete a server owned variable?

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Poyz
Posts: 83
Joined: 28 Mar 2006, 14:27

delete a server owned variable?

Postby Poyz » 26 Apr 2006, 13:44

hi all,
i created a room var this way:

var varList = []
varList.push( {name:myName, val:myVal} )
_server.setRoomVariables(room, null, varList)

and when i try to delete it passing a null value:

var varList = []
varList.push( {name:myName, val:null} )
_server.setRoomVariables(room, null, varList)

the variable is still there and still has the old value
is there a way to delete the variable so it returns null when i check it's existence later on?
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 27 Apr 2006, 15:17

mmm...
it depends on the current status of the variable.
For example a persistent variable owned by the server can't be deleted, because it's ... persistent ( so you want it to exist all the time )

Did you check this?
Lapo
--
gotoAndPlay()
...addicted to flash games
Poyz
Posts: 83
Joined: 28 Mar 2006, 14:27

Postby Poyz » 27 Apr 2006, 15:24

if persistent is default then i think it is... checking
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 27 Apr 2006, 15:35

no persistent is not default. Both private and persistent are false if you don't specify them
Lapo

--

gotoAndPlay()

...addicted to flash games
Poyz
Posts: 83
Joined: 28 Mar 2006, 14:27

Postby Poyz » 27 Apr 2006, 15:46

in fact i tryed with persistent=false and private both false and true...
it just doesnt delete the variable, i can change it to anything else, but if i pass the null value it keeps the old value
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 27 Apr 2006, 16:56

ok, we'll verify if there's a bug with the variable deletion.

Stay tuned
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 28 Apr 2006, 13:13

Ok,
the bug was found... actually the bug is a really weird one.

The problem is with Rhino, the AS/JS engine.
It seems that null object return "object" when you check their type with typeof() instead of "null"

Code: Select all

var p = null
trace("Type: " + typeof(p))

I'd expect to trace "null" but it actually trace "object".

That said you can see why the deletion doesn't work. The null value that you pass in the Room Variable you want to delete is not recognized as type == "null".

Solution:
Before we release a patched version, you can quickly stop the problem from happening by following these steps:

- download this file and unzip it
- copy it to your Server/lib/ folder
- reload your extension(s)

Finally, in oder to delete a room variable, pass an undefined value instead of null

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 48 guests