In that case, I believe you'll be on an outdated version of ComputerCraft with an outdated version of OpenPeripheral. Both are likely more up to date then the versions he wrote that script for.
Generally version doesn't matter so much with ComputerCraft (though it sounds like the coming 1.6 might change all that...), though again, OpenPeripheral's commands have been changing around recently.
Anyway, um, that's not how you'd do it. Function definitions don't do anything unless you call them, so just plonking such a definition in the middle of an existing function won't work.
I took a stab at re-writing it correctly, but the "destination" table index has proven to be a bit of a stumbling block. I've no idea which versions of OpenPeripheral support it, as OP's documentation (both in terms of the commands available to each version and in terms of a changelog) leaves... much to be desired. Hopefully the main thread on this forum will be locked and replaced shortly.
Best I can make out (and this is mostly conjecture), the "destination" field was added at some point while MineCraft 1.5.x was current and then later removed when OpenPeripheral hit MineCraft 1.6.x. Given that MystCraft (and all the other mods OpenPeripheral has to deal with) may or may not've updated to 1.6.x at that time, this would be completely understandable.
The version of OpenPeripheral I have installed is 0.2.1-preview8 (for MC 1.6.x), which is quite old now. The version of DireWolf I'm running is 1.0.11, which is also old. I have no idea if the latest Direwolf pack has a later version of OpenPeripheral, and in the event that it does, I've no idea if that can read destinations from linking books (the version I've got can't). Nor do I have much interest in installing the however many versions of OpenPeripheral / MineCraft it takes to determine what each can and cannot do.
Anyway.
Assuming whatever versions you're running DO have this table element, this should work:
function checkSlots(id)
clearInv()
data = {}
local slot
for i=1,p.getInventorySize() do
slot = p.getStackInSlot(i)
if slot then data[i] = slot.destination end
end
rednet.send(id,"done")
end
If not? You'll likely find that the script runs, but no destinations show up on your monitor. Using "slot.name" instead of "slot.destination" would be a (rather poor, but simple to implement) workaround for this.