Maybe there are zero vertices/tris in the surface you are checking...
Try this:
Try this:
function DebugMeshCounts(mesh) n_surfs = countsurfaces(mesh) debuglog "surfaces: "+n_surfs for s = 1 to n_surfs surf = getsurface(mesh,s) n_verts = countvertices(surf) n_tris = counttriangles(surf) debuglog "surface "+s+" verts: "+n_verts+" tris: "+n_tris t_verts = t_verts+n_verts t_tris = t_tris+n_tris next debuglog "total verts: "+t_verts debuglog "total tris: "+t_tris end function