local pos = {x = x, y = y, z = z, stackpos = 255} -- stackpos = 255- top thing (movable item or creature), stackpos = 254- magic field stackpos = 253- top creature
local thing = getThingFromPos(pos)
local count
if thing > 0 then ---make sure it found something
count = thing.type
end