Get SID from object-type
var sid = objtype.sid
Get object-type from sid
var obktype = this.runtime.getObjectTypeBySid(sid);
It will check the object-types list to find the matched target. Keeping the index of the matched target might increase the performance.
var objtypes = this.runtime.types_by_index;
var t = objtypes[index];
if ((t != null) && (t.sid === sid)) // find the target
return t;
var i, len=objtypes.length;
for (i=0; i<len; i++)
{
t = objtypes[i];
if (t.sid === sid) // find the target
{
index = i; // save the index
return t;
}
}
Reference
No comments:
Post a Comment