typegraph/scripts/generic/assertInstanceof.gml

18 lines
462 B
Plaintext

///assertInstanceof(id, ind)
/**
* assertInstanceof :: Instance -> Class -> Bool
*
* Asserts `id` is of type `ind`, either directly or via the parent hierarchy.
*
* @param id the instance to check
* @param ind the object type to check for
* @returns true if id is of type ind, false otherwise
*/
var res = instanceof(argument0, argument1);
assert(res, "'"+getInstObjName(argument0)+"' is not an instance of "+getInstObjName(argument1));
return res;