`peripheral.find` should return varargs, not an array
As per the official documentation:
Returns
table...0 or more wrapped peripherals matching the given filters.
Given a Lua script for CC: Tweaked:
local n_monitors = select('#', peripheral.find("monitor"))
print(n_monitors)
... with no monitors connected, the script prints 0, with one monitor, the script prints 1, and with two monitors, the script prints 2. So, the function returns varargs.