Update Lua OC Scripts.

This commit is contained in:
Captain ALM 2019-12-29 12:12:55 +00:00
parent e9b88eb6d4
commit 0a9479d98f
2 changed files with 7 additions and 28 deletions

View File

@ -66,7 +66,8 @@ end
local function readc(con) local function readc(con)
local herr = false local herr = false
local data = "" local data = ""
while not herr do local lout = 0
while ((not herr) and (lout < 50)) do
try { try {
function() function()
local tmp = "" local tmp = ""
@ -75,7 +76,11 @@ local function readc(con)
if tmp ~= "" then if tmp ~= "" then
data = data..tmp data = data..tmp
con:setTimeout(0) con:setTimeout(0)
else
lout = lout + 1
end end
else
lout = lout + 1
end end
end, end,
catch { catch {
@ -85,6 +90,7 @@ local function readc(con)
} }
} }
end end
lout = 0
if data == "" then if data == "" then
data = nil data = nil
end end

View File

@ -60,33 +60,6 @@ function try(block)
return result return result
end end
local function readc(con)
local herr = false
local data = ""
while not herr do
try {
function()
local tmp = ""
tmp = con:read(1)
if tmp ~= nil then
if tmp ~= "" then
data = data..tmp
end
end
end,
catch {
function(ex)
herr = true
end
}
}
end
if data == "" then
data = nil
end
return data
end
local function shandshake(con) local function shandshake(con)
print("Sending Handshake...\n") print("Sending Handshake...\n")
con:write("2") con:write("2")