Quote:
Originally Posted by fowlplay4
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.a = 123;
temp.ex.b = 234;
temp.ex.c = 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.