Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   TStatic Objects (https://forums.graalonline.com/forums/showthread.php?t=84088)

The_Kez 02-08-2009 08:25 PM

TStatic Objects
 
Is there a way to delete attributes from a TStaticVar so that it isn't returned from obj.getdynamicvarnames() ?

I know if you create such a function like...

PHP Code:

function Test() {
  
temp.obj = new TStaticVar();
  
obj.val  5;
  
obj.destroy();


This would destroy the object, obviously. I need something more like...

PHP Code:

function Test() {
  
temp.obj = new TStaticVar();
  
obj.val  5;
  
obj.val.destroy();


I've tried using .destroy() on the attribute, and setting it to NULL + using clearemptyvars(), but neither of those work.
Any help would be appreciated :)

Chompy 02-08-2009 08:53 PM

PHP Code:

function onCreated() {
  
temp.obj = new TStaticVar();
  
  
obj.val 5;
  
obj.val "";
  
obj.clearemptyvars();
  
  echo(
obj.getdynamicvarnames());


Works fine for me :]

LoneAngelIbesu 02-08-2009 10:38 PM

Quote:

Originally Posted by The_Kez (Post 1464258)
I've tried using .destroy() on the attribute, and setting it to NULL + using clearemptyvars(), but neither of those work.
Any help would be appreciated :)

NULL and "" aren't the same, last time I checked? That's why Chompy's works and yours doesn't.

The_Kez 02-08-2009 10:50 PM

I noticed that it worked once I had set it to empty string literal. I think NULL should count as an empty var. ;o

Inverness 02-08-2009 10:54 PM

null is equal to 0 (in Graal).


All times are GMT +2. The time now is 02:37 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.