Thread: TStaticVar()
View Single Post
  #7  
Old 03-21-2015, 07:47 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by fowlplay4 View Post
loadvarsfromarray and savevarstoarray is used for serialization. Useful for when you want to send an object over a method that doesn't support them or save it to a file.

e.g. triggers

PHP Code:
function onCreated() {
  
temp.ex.123;
  
temp.ex.234;
  
temp.ex.345;
  
temp.data temp.ex.savevarstoarray(false);
  
findplayer("fowlplay4").triggerclient("weapon"this.name"data"temp.data);
}

//#CLIENTSIDE

function onActionClientSide() {
  if (
params[0] == "data") {
    
temp.data params[1];
    
temp.ex.loadvarsfromarray(temp.data);
    echo(
temp.ex.a SPC temp.ex.b SPC temp.ex.c); // echos 123 234 345
  
}

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.
Reply With Quote