Thread: TStaticVar()
View Single Post
  #8  
Old 03-23-2015, 02:25 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by scriptless View Post
Hmm, well is there any instance that I would be forced to use TStaticVar, or better to use? I generally find myself just using vars like I mentioned. Not sure if that is good practice, or if I should look more into using TStaticVar's?

Sorry if it sounds like a noob question just the overwhelming lack of documentation for GScript2 makes understanding somewhat difficult at times.

Also, thanks FP4 for the reply. Ans also not trying to hijack the thread. It's still relevant to discussion of the TStaticVar.
If you don't want to constantly serialize your dictionary ("object") every time you want to pass it around, you can use a TStaticVar instead. This can be moderately faster and easier to read (less boilerplate).

This won't work going across serverside/clientside, of course -- you'll need to serialize in this case.

Also iirc savevarstoarray on a non-TStaticVar will include the random built-in object properties (stuff like initialized, joinedclasses, timeout, ...) in at least some cases. But I can't remember if that's true or not.
__________________
Reply With Quote