Antonio, (ssname) function will return parent entityname instead of nested... My version uses (entnext) to build list of all entity + nested entity names and then it retrieves previous one from supplied entity , wich can be nested too...
Test this with 3d polyline entity or old heavy 2d polyline and see what I am talking about...
M.R.