![]() |
getstringkeys problems
PHP Code:
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? |
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). |
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. |
this.foo.bar.test=true;
getstringkeys("this.") would return 'foo' getstringkeys("this.foo.") would return 'bar' getstringkeys("this.foo.bar.") would return 'test' |
this.foo.bar = "" is doing what you want
|
| All times are GMT +2. The time now is 09:36 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.