Game Development Community

Structs in TorqueScript?

by Imre Chroncsik · in Torque Game Engine · 03/07/2006 (7:09 am) · 2 replies

Is it possible to create some kind of structs in TorqueScript? I'd like to group my variables for easier access. I mean things like:

%client.myStruct.myValue = 1;
%s = %client.myStruct;
%s.myValue = 2;
echo(%client.myStruct.myValue); // should echo 2

I've tried different syntax variations, but none of them worked.
Thanks for any help.

About the author

Recent Threads


#1
03/07/2006 (7:44 am)
Try Scriptobjects using a class will tie it to callbacks

%struct = new scriptObject(){
    class = fred;
};

function fred::onAdd(%this){
//init here
}
function fred::onremove(%this){
//destroy here
}
#2
03/07/2006 (7:54 am)
Ah. Thanks!