Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-08-2009, 08:25 PM
The_Kez The_Kez is offline
N-Pulse Asst. Manager
The_Kez's Avatar
Join Date: Dec 2007
Posts: 106
The_Kez is on a distinguished road
Send a message via MSN to The_Kez
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
Reply With Quote
  #2  
Old 02-08-2009, 08:53 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
PHP Code:
function onCreated() {
  
temp.obj = new TStaticVar();
  
  
obj.val 5;
  
obj.val "";
  
obj.clearemptyvars();
  
  echo(
obj.getdynamicvarnames());

Works fine for me :]
__________________
Reply With Quote
  #3  
Old 02-08-2009, 10:38 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by The_Kez View Post
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.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #4  
Old 02-08-2009, 10:50 PM
The_Kez The_Kez is offline
N-Pulse Asst. Manager
The_Kez's Avatar
Join Date: Dec 2007
Posts: 106
The_Kez is on a distinguished road
Send a message via MSN to The_Kez
I noticed that it worked once I had set it to empty string literal. I think NULL should count as an empty var. ;o
Reply With Quote
  #5  
Old 02-08-2009, 10:54 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
null is equal to 0 (in Graal).
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:36 AM.


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