2021-01-12 01:41:11 +01:00

22 lines
518 B
Plaintext

--lua module "utils" for random utilities
if utils then return end --avoid loading twice
utils = {}
function utils.getSideOf(name) --get which side, if any, a peripheral p is connected to
local sides = peripheral.getNames()
for i = 1, #sides do
if peripheral.getType(sides[i]) == name then
--found it!
return sides[i]
end
end
end
function printToMon(mon, text)
local x, y = mon.getCursorPos()
mon.write(text)
mon.setCursorPos(x, y+1)
end
return utils