include("object.lua"); CObjectList = class( function (self) self.Objects = {}; end ); function CObjectList:update() local proc = getProc() self.Objects = {}; -- Flush all objects. local size = memoryReadInt(proc, addresses.staticTableSize).."I" local startadd = memoryReadUInt(proc, addresses.staticTablePtr) local results = memoryReadBatch(proc,startadd,size) for k,v in ipairs(results) do if v > 0 then self.Objects[k-1] = CObject(v); -- had to -1 for backward compatability, used to start at 0 and not 1. end end end function CObjectList:getObject(index) if( index < 0 or index > #self.Objects ) then error("Call to CObjectList:getObject failed: index out of bounds", 2); end return self.Objects[index]; end function CObjectList:size() return #self.Objects; end