Is there any way of getting all the non-nil parameters / properties
of an object? I found this: getmetadata(self.xxxx)
and i am looking for something like: ge
I wrote my own printObject code.. here it is
function printObj(obj, hierarchyLevel)
if (hierarchyLevel == nil) then
hierarchyLevel = 0
elseif (hierarchyLevel == 4) then
return 0
end
local whitespace = ""
for i=0,hierarchyLevel,1 do
whitespace = whitespace .. "-"
end
io.write(whitespace)
print(obj)
if (type(obj) == "table") then
for k,v in pairs(obj) do
io.write(whitespace .. "-")
if (type(v) == "table") then
printObj(v, hierarchyLevel+1)
else
print(v)
end
end
else
print(obj)
end
end
This is the opposite approach then the post before used. Go through all key value pairs in the table. If the value of one index is a table, go through this table. This solution will not get the upwards metatables like the other post did