Game Development Community

Mini array

by Erik Madison · in Torque Game Engine · 09/07/2004 (8:35 am) · 1 replies

I need a list in script, very simple.
{'a', 'b', 'c'} This would be static. Next I need a small fuction to see if an element exists in the list, IsElement(%input) {} For the life of me, I can't figure out how to do this only in script, although I'm pretty sure TS can do it. I know how to do it in c++, but I don't need that kind of overhead. I also am familiar with Daniel Nielsens arrayobject script addon, but that also contains too much overhead for my current need. (not to mention I can't get it to work anyways:))
Anyone?

#1
09/07/2004 (2:30 pm)
TorqueScript support arrays. I would suggest making the list global and assigning the members like
$list[1]='a';
$list[2]='b';

to search the list all you need is a for... if($list[%i]==%input) return true;