get("#380") -- hashImage w, h = img.width, img.height function cacheImage() cached = {} for i = 1, 100 do local x, y = math.random(0, w-1), math.random(0, h-1) cached[i] = {x, y, img.getInt(x, y)} end end function hasMovement() for i = 1, #cached do local x, y, pix = unpack(cached[i]) if img.getInt(x, y) ~= pix then return true end end return false end return function() if cached == nil then cacheImage() return nil -- "Initializing..." end if hasMovement() then cacheImage() return "Movement" else cacheImage() -- optional, but a little safer return "Probably no movement" end end