mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
Merge branch master-MC1.10 into master-MC1.11
This commit is contained in:
commit
57de51b8b8
@ -25,30 +25,16 @@ package.loaded.coroutine = _G.coroutine
|
|||||||
local kernel_load = _G.load
|
local kernel_load = _G.load
|
||||||
local intercept_load
|
local intercept_load
|
||||||
intercept_load = function(source, label, mode, env)
|
intercept_load = function(source, label, mode, env)
|
||||||
if env then
|
local prev_load = env and env.load or _G.load
|
||||||
local prev_load = env.load or intercept_load
|
local e = env and setmetatable({
|
||||||
local next_load = function(_source, _label, _mode, _env)
|
load = function(_source, _label, _mode, _env)
|
||||||
return prev_load(_source, _label, _mode, _env or env)
|
return prev_load(_source, _label, _mode, _env or env)
|
||||||
end
|
end}, {
|
||||||
if rawget(env, "load") then -- overwrite load
|
__index = env,
|
||||||
env.load = next_load
|
__pairs = function(...) return pairs(env, ...) end,
|
||||||
else -- else it must be an __index load, or it didn't have one
|
__newindex = function(tbl, key, value) env[key] = value end,
|
||||||
local env_mt = getmetatable(env) or {}
|
})
|
||||||
local env_mt_index = env_mt.__index
|
return kernel_load(source, label, mode, e or process.info().env)
|
||||||
env_mt.__index = function(tbl, key)
|
|
||||||
if key == "load" then
|
|
||||||
return next_load
|
|
||||||
elseif type(env_mt_index) == "table" then
|
|
||||||
return env_mt_index[key]
|
|
||||||
elseif env_mt_index then
|
|
||||||
return env_mt_index(tbl, key)
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
setmetatable(env, env_mt)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return kernel_load(source, label, mode, env or process.info().env)
|
|
||||||
end
|
end
|
||||||
_G.load = intercept_load
|
_G.load = intercept_load
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ local function clear_line(window, _, n)
|
|||||||
n = tonumber(n) or 0
|
n = tonumber(n) or 0
|
||||||
local x = n == 0 and window.x or 1
|
local x = n == 0 and window.x or 1
|
||||||
local rep = n == 1 and window.x or window.width
|
local rep = n == 1 and window.x or window.width
|
||||||
window.gpu.set(x, window.y, (" "):rep(rep))
|
window.gpu.fill(x, window.y, rep, 1, " ")
|
||||||
end
|
end
|
||||||
rules[{"%[", "[012]?", "K"}] = clear_line
|
rules[{"%[", "[012]?", "K"}] = clear_line
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ end
|
|||||||
-- D scroll up one line -- moves cursor down
|
-- D scroll up one line -- moves cursor down
|
||||||
-- E move to next line (acts the same ^, but x=1)
|
-- E move to next line (acts the same ^, but x=1)
|
||||||
-- M scroll down one line -- moves cursor up
|
-- M scroll down one line -- moves cursor up
|
||||||
rules[{"[DEM]"}] = function(window, dir)
|
rules[{"%[", "[DEM]"}] = function(window, _, dir)
|
||||||
if dir == "D" then
|
if dir == "D" then
|
||||||
window.y = window.y + 1
|
window.y = window.y + 1
|
||||||
elseif dir == "E" then
|
elseif dir == "E" then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user