Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- multishell.setTitle(multishell.getCurrent(), "term")
- local m = peripheral.find("modem")
- local senderID = os.getComputerLabel() == nil and "ID:" .. os.getComputerID() or os.getComputerLabel()
- local channels = {
- ["stdout"] = 1000,
- ["stdin"] = 1001,
- ["witherout"] = 1010,
- ["witherin"] = 1011
- }
- local function sendCmd(program, cmd, ...)
- m.transmit(channels.stdin, channels.stdout,
- {
- ["program"] = program,
- ["type"] = "cmd",
- ["cmd"] = cmd,
- ["text"] = {...},
- ["sender"] = senderID
- })
- end
- function split(inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={} ; i=1
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- t[i] = str
- i = i + 1
- end
- return t
- end
- while true do
- sendCmd("control", unpack(split(read())))
- end
Add Comment
Please, Sign In to add comment