mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 02:39:48 -04:00
Merge pull request #2261 from payonel/1.6.1-update
term safe slow write, fix pastebin get, low mem loadfile fix closes #2230 closes #1308
This commit is contained in:
commit
989f39b7c8
@ -21,7 +21,7 @@ local function get(pasteId, filename)
|
|||||||
end
|
end
|
||||||
|
|
||||||
io.write("Downloading from pastebin.com... ")
|
io.write("Downloading from pastebin.com... ")
|
||||||
local url = "http://pastebin.com/raw.php?i=" .. pasteId
|
local url = "http://pastebin.com/raw/" .. pasteId
|
||||||
local result, response = pcall(internet.request, url)
|
local result, response = pcall(internet.request, url)
|
||||||
if result then
|
if result then
|
||||||
io.write("success.\n")
|
io.write("success.\n")
|
||||||
|
@ -15,7 +15,8 @@ function loadfile(filename, mode, env)
|
|||||||
end
|
end
|
||||||
table.insert(buffer, data)
|
table.insert(buffer, data)
|
||||||
end
|
end
|
||||||
buffer = table.concat(buffer):gsub("^#![^\n]+", "") -- remove shebang if any
|
buffer[1] = (buffer[1] or ""):gsub("^#![^\n]+", "") -- remove shebang if any
|
||||||
|
buffer = table.concat(buffer)
|
||||||
return load(buffer, "=" .. filename, mode, env)
|
return load(buffer, "=" .. filename, mode, env)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -390,7 +390,13 @@ function term.drawText(value, wrap, window)
|
|||||||
local function scroll(_sy,_y)
|
local function scroll(_sy,_y)
|
||||||
return _sy + term.internal.scroll(window,_y-h), math.min(_y,h)
|
return _sy + term.internal.scroll(window,_y-h), math.min(_y,h)
|
||||||
end
|
end
|
||||||
|
local uptime = computer.uptime
|
||||||
|
local last_sleep = uptime()
|
||||||
while index <= vlen do
|
while index <= vlen do
|
||||||
|
if uptime() - last_sleep > 4 then
|
||||||
|
os.sleep(0)
|
||||||
|
last_sleep = uptime()
|
||||||
|
end
|
||||||
local si,ei = value:find("[\t\r\n\a]", index)
|
local si,ei = value:find("[\t\r\n\a]", index)
|
||||||
si = si or vlen+1
|
si = si or vlen+1
|
||||||
if index==si then
|
if index==si then
|
||||||
@ -401,7 +407,7 @@ function term.drawText(value, wrap, window)
|
|||||||
x,y=1,y+1
|
x,y=1,y+1
|
||||||
sy,y = scroll(sy,y)
|
sy,y = scroll(sy,y)
|
||||||
elseif delim=="\a" and not beeped then
|
elseif delim=="\a" and not beeped then
|
||||||
require("computer").beep()
|
computer.beep()
|
||||||
beeped = true
|
beeped = true
|
||||||
end
|
end
|
||||||
cr_last = delim == "\r"
|
cr_last = delim == "\r"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user