mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 17:56:34 -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
|
||||
|
||||
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)
|
||||
if result then
|
||||
io.write("success.\n")
|
||||
|
@ -15,7 +15,8 @@ function loadfile(filename, mode, env)
|
||||
end
|
||||
table.insert(buffer, data)
|
||||
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)
|
||||
end
|
||||
|
||||
|
@ -390,7 +390,13 @@ function term.drawText(value, wrap, window)
|
||||
local function scroll(_sy,_y)
|
||||
return _sy + term.internal.scroll(window,_y-h), math.min(_y,h)
|
||||
end
|
||||
local uptime = computer.uptime
|
||||
local last_sleep = uptime()
|
||||
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)
|
||||
si = si or vlen+1
|
||||
if index==si then
|
||||
@ -401,7 +407,7 @@ function term.drawText(value, wrap, window)
|
||||
x,y=1,y+1
|
||||
sy,y = scroll(sy,y)
|
||||
elseif delim=="\a" and not beeped then
|
||||
require("computer").beep()
|
||||
computer.beep()
|
||||
beeped = true
|
||||
end
|
||||
cr_last = delim == "\r"
|
||||
|
Loading…
x
Reference in New Issue
Block a user