Game Development Community

Real quick TorqueDB question

by Drew -Gaiiden- Sikora · in Torque Game Builder · 11/29/2005 (3:04 am) · 2 replies

Nuther quickie :P

How do I get the size of a record? Like I have a tag and there are 4 of them. How do I determine this in code?

#1
11/29/2005 (5:48 pm)
Been a while since I've looked at Torque DB... but try this function

There are two ammounts I'm guessing you might want, this is the property count of a class

function TorqueDB::getPropertyCount(%className)
{
   %class = TorqueDB.returnClass(%className);
   %num = $subTagCount[%class];

   return %num;
}

this is to get the record count

function TorqueDB::getRecordCount(%className)
{
   %class = TorqueDB.returnClass(%className);
   %num = $mainValueArray.contents[%class];

   return %num;
}

test them first though... let me know if this works :)
#2
11/30/2005 (7:30 pm)
Thanks Matt! works great. The only problem is where would be the best place to put these functions? I tried putting them in the torqueDB.cs file after all the other files were exec'd but for some reason calling the functions doesn't work. Pasting the body of the functions in the same place I'm calling from works perfectly, but when I call them they return squat. Any ideas? Thanks again.