Skip to content

Instantly share code, notes, and snippets.

@Tiim
Last active May 4, 2018 08:49
Show Gist options
  • Save Tiim/4402389 to your computer and use it in GitHub Desktop.
Save Tiim/4402389 to your computer and use it in GitHub Desktop.
local monitor = peripheral.wrap("right");
rednet.open("top");
maxX, maxY = monitor.getSize();
curX, curY = 1,1;
print("Max X: " .. maxX .. " Max Y: " .. maxY);
names = {};
function split(msg)
t="";
i=1
cmd = string.gmatch(msg, "([^,]+)")
for str in string.gmatch(msg, "([^,]+)") do
t = t .. str
i = i + 1
end
return cmd, t;
end
function parseMsg(msg)
cmd, mess = split(msg);
print(cmd)
print(mess)
if cmd == "log" then
log(mess);
end
end
function log(args)
monitor.serCursorPos(curX,curY);
monitor.write(args);
curY = curY + 1
if curY == maxY - 1 then
monitor.scroll(1);
curY = curY - 1
end
end
parseMsg("log, Hallo Welt");
--while true do
--local senderId, message, distance = rednet.receive();
--parseMsg(message);
--end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment