mirror of https://github.com/kepler155c/opus
error handling
This commit is contained in:
parent
cceb6c8409
commit
f16c7b632b
|
@ -516,6 +516,7 @@ local function autocomplete(line)
|
||||||
for _,sItem in pairs(results) do
|
for _,sItem in pairs(results) do
|
||||||
nMaxLen = math.max(string.len(sItem) + 1, nMaxLen)
|
nMaxLen = math.max(string.len(sItem) + 1, nMaxLen)
|
||||||
end
|
end
|
||||||
|
local w = term.getSize()
|
||||||
local nCols = math.floor(w / nMaxLen)
|
local nCols = math.floor(w / nMaxLen)
|
||||||
if #tDirs < nCols then
|
if #tDirs < nCols then
|
||||||
for _ = #tDirs + 1, nCols do
|
for _ = #tDirs + 1, nCols do
|
||||||
|
|
|
@ -69,7 +69,11 @@ Event.addRoutine(function()
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if peripheral[data.fn] then
|
if peripheral[data.fn] then
|
||||||
|
-- need to trigger an error on the other end
|
||||||
|
-- local s, m = pcall()
|
||||||
socket:write({ peripheral[data.fn](table.unpack(data.args)) })
|
socket:write({ peripheral[data.fn](table.unpack(data.args)) })
|
||||||
|
else
|
||||||
|
socket:write({ false, "Invalid function: " .. data.fn })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,11 @@ Event.addRoutine(function()
|
||||||
if api then
|
if api then
|
||||||
local proxy = _G[api]
|
local proxy = _G[api]
|
||||||
|
|
||||||
|
if not proxy then
|
||||||
|
print('proxy: invalid API')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local methods = { }
|
local methods = { }
|
||||||
for k,v in pairs(proxy) do
|
for k,v in pairs(proxy) do
|
||||||
if type(v) == 'function' then
|
if type(v) == 'function' then
|
||||||
|
|
Loading…
Reference in New Issue