From 039531fea0b602205464655ac5dd903fa2f3d904 Mon Sep 17 00:00:00 2001 From: osmarks Date: Tue, 11 Jun 2024 15:18:13 +0100 Subject: [PATCH] Update lms.lua --- computercraft/lms.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/computercraft/lms.lua b/computercraft/lms.lua index e3a96f7..37140a2 100644 --- a/computercraft/lms.lua +++ b/computercraft/lms.lua @@ -1,5 +1,5 @@ local function update() - local h = http.get "https://pastebin.com/raw/L0ZKLBRG" + local h = http.get "https://raw.githubusercontent.com/osmarks/misc/master/computercraft/lms.lua" local f = fs.open(shell.getRunningProgram(), "w") f.write(h.readAll()) f.close() @@ -109,7 +109,7 @@ local function send() if preproc(msg) == "" then print_message "Your message is considered spam." else - add_message(msg, username) + add_message(msg, username:sub(1, 16)) m.transmit(chan, chan, { message = msg, username = username }) end end @@ -119,7 +119,7 @@ end local function recv() while true do local _, _, channel, _, message = os.pullEvent "modem_message" - if channel == chan and type(message) == "table" and message.message and message.username then + if channel == chan and type(message) == "table" and message.message and message.username and type(message.message) == "string" and type(message.username) == "string" then notification_sound() add_message(message.message, message.username) end @@ -127,4 +127,4 @@ local function recv() end m.transmit(chan, chan, { username = username, message = "Connected." }) -parallel.waitForAny(send, recv) \ No newline at end of file +parallel.waitForAny(send, recv)