

function print_table(t)
    tw, th = term.getSize()
    n = 1
    for k,v in pairs(t) do
        print(tostring(k)..': '..tostring(v))
        n = n + 1
        if n > th - 2 then
          print('press enter to continue,,,')
          read()
          n = 1
        end
    end    
end

p = peripheral.wrap('top')

ids = p.getMobIds()

mob = p.getMobData(ids[1])
print_table(mob)


function find_straw_golem()
    ids = p.getMobIds()
    for i = 1, #ids do
        id = ids[i]
        mob = p.getMobData(id)
        if mob.type == 'Straw Golem' then
            print(id)
            print_table(mob.armor)
            --return id
        end
    end
end

golem_id = nil 


print_table(p.getPlayerNames())

--while not golem_id do
    golem_id = find_straw_golem()
--    if not golem_id then
--        os.sleep(30)
--    end
--end
--print('Straw golem has id '..golem_id)

