PDA

View Full Version : Infinite Nested Variables



dsmes
December 29th, 2009, 01:08 PM
Why do some variables in the Girder Variable Display appear to have infinitely deep nesting? e.g.
DeviceManager.Classes.DeviceList.__index.__index._ _index.__index.__index.__index...
gd.metatable.__index.metatable.__index.metatable._ _index.metatable.__index...
ltn12._M._M._M._M._M._M...
lxp.cwlom._M._M._M._M._M._M...
lxp.lom._M._M._M._M._M._M._M...
mouse.MouseControl.__index.__index.__index.__index .__index.__index.__index...
mime._M._M._M._M._M._M...Doesn't seem to be a problem. Just wondering.

Rob H
December 30th, 2009, 07:04 AM
Looks like it's infinite recursion caused by Lua code such as



New = function (self,o)
o = o or {}
setmetatable (o,self)
self.__index = self
o.Initialize (o)
return o
end,

which is a common idiom used to provide object orientation in Lua.

The variable inspector code could maybe handle this situation in a better way, but that would probably slow it down a bit.

dsmes
January 4th, 2010, 10:18 PM
I'm surprised the infinite recursion doesn't have some unintended consequences or give rise to some Lua variable inspector delay (like my 46931 NR variables do in NRD). Or are you saying this is an artifact of the variable inspector code and in reality, it's only one layer deep?

Rob H
January 5th, 2010, 09:12 AM
It's probably only one layer deep, and Girder will only check the next level if the user expands the tree at that point. Ron would have to confirm that though.

Ron
January 5th, 2010, 10:25 AM
Rob is correct the Variable Inspector only requests the level it is going to show. So infinite recursion is no problem for it.