Finding the number of slots in an instance


#1

I’m traversing through various large structures, replete with arrays, functions, classes, nulls, tables, strings, scalar values and instances. The squirrel documentation indicates that instances are really specialised tables. Even though I can iterate through the objects in an instance (as I can with a table), I can’t determine the number of slots in the instance. Is this an omission from squirrel?
This code demonstrates the problem.

`t <- {
    var1=1
    var2=2
    var3=3
}

foreach(k,v in t)
    server.log("key="+k+" value="+v)

server.log("table len="+t.len())

class c{
    var1=1
    var2=2
    var3=3
}
i <- c()

foreach(k,v in i.getclass())  //works
    server.log("key="+k+" value="+i[k])

server.log("instance len="+i.getclass().len())  // fails
server.log("instance len="+c.len())  //fails
server.log("instance len="+i.len())  //fails
`