Graal Forums  

Go Back   Graal Forums > Development Forums > Tech Support
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-13-2006, 07:50 AM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
getstringkeys problems

PHP Code:
function onCreated(){
  
this.foo.bar.test=true;
  
getstringkeys("this.foo");

getstringkeys returns nothing.. when it should return: bar.test

I realize this is for things like.. objects.. but this isnt being saved like an object, its beign saved like a flag named "foo.bar.test"
I can not make it an object (with TStaticVar()) because they are not saved in the objects flags.. and cant be saved using savevars() and I need to be able to save them (for backing them up)

What I am really trying to do is destroy them..

ie if I have a variable this.foo.bar.test="foo bar"; and this.foo.bar.anchor="hi"; i need to be able to destroy them as easy as (if they were objects) doing this.foo.bar.destroy()
Its weird.. its like its TRYING to treat it like an object.. but they arent.

What can I do?
Reply With Quote
  #2  
Old 07-13-2006, 11:09 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
I think you can just do this.foo.bar = ""
The getstringkeys function is only listing variables starting with the name (this.foo_test, this.foo123), not subvariables of this.foo. If you want to get all sub variables then use obj.savevars(filename,append) or obj.savevarstoarray(sort) (which returns an array).
Reply With Quote
  #3  
Old 07-13-2006, 07:23 PM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
this.foo.bar=""; does not work because its not ACTUALLY a subvariable.. its really just a flag with a period in it. the variable type() == 0 so its not an object with subvariables.

I used the periods like this without making it a TStaticVar() because I need them to be saved in savevars.

If you make them TStaticVar() then I can not just do this.savevars(path/to/file); to save all the so-called subvariables.. I would have to go to each individual subvariable and do it.. which I do not want to because I am using savevars() to backup all the data since its in a DBNPC and they frequently mess up ie: when servers crash.

What you COULD do to fix this problem would be to make a destroy() function for TGraalVar that would function just like the destroy() function in objects.

ie:
this.foo.destroy();

would remove this.foo.bar.test="true"; and all other variables beneath it.

Since all these things show up in getvarnames() and such, it should not be a problem.

But I REALLLLLY need this in order to procede with making my database. I am at a stand still now.
Reply With Quote
  #4  
Old 07-13-2006, 08:03 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
this.foo.bar.test=true;
getstringkeys("this.") would return 'foo'
getstringkeys("this.foo.") would return 'bar'
getstringkeys("this.foo.bar.") would return 'test'
Reply With Quote
  #5  
Old 07-13-2006, 08:51 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
this.foo.bar = "" is doing what you want
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 07:28 PM.


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