It's useful for when you want to create an object to pass to another function or script. It also provides a clean object slate that doesn't have all the predefined Graal variables.
PHP Code:
function onCreated() {
temp.noobj.x = 3;
temp.noobj.y = 5;
echo(temp.noobj.x SPC temp.noobj.y);
test(temp.noobj);
temp.obj = new TStaticVar();
temp.obj.x = 3;
temp.obj.y = 5;
test(temp.obj);
// make sure you destroy them when you're done with them
// as they aren't always garbage collected properly...
temp.obj.destroy();
}
function test(obj) {
if (obj.x || obj.y) {
echo(obj.x SPC obj.y);
} else {
echo("no x or y detected");
}
}
echos
3 5
no x or y detected
3 5