![]() |
Script Questions (Globals, Types, References, .link(), TStaticVar)
(I tried my best in making this follow-able and readable, but I tend to be bad at explaining, so please ask if something is unclear)
Globals When are global variables reset? Do they last till the server is restarted? Are they affected by some kind of Garbage Collection? Types Every uninitialized variable appears to be a TGraalVar according to .objecttype(), why is that? References What is passed by reference and what is passed by value? What can store a reference? How does .link() affect that? To elaborate: PHP Code:
PHP Code:
Why can't temp.x.text access this.list.x.text? is that because this.list.x is null, thus doing temp.x = this.list.x; you set temp.x to null and not to a reference of an object that would look like { text: "b" } in JSON? Is there any way to return such a reference? I might be able to return a string and makevar that or such... not sure if that would be of any help and I think i would have to makevar for each subvariable of this.list.x / temp.x I would try to access? One way I seemingly found to do something is to do: PHP Code:
PHP Code:
Another way I found was to make this.list.x a TStaticVar, which would then allow temp.x to be non-null and temp.x.text to access this.list.x.text. Which also leads to another question: Is there a computational difference (storage, processing cost) between TStaticVar and TGraalVar aside the ability to destroy StaticVars? I've heard StaticVar's without reference are cleaned up by GC at some point, but it still being advised to destroy them manually if you can. When are TGraalVars collected? Immediately when they lack any reference? Or on a GC cycle too? If the latter, wouldn't it be better to use TStaticVar wherever possible? |
I'm no scripter, but for future help I'd gain access to the testbed server. A lot of on-deck help there.
|
Thanks, I do have access there already ^^
|
All times are GMT +2. The time now is 01:10 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.