mirror of
https://github.com/kepler155c/opus
synced 2025-03-03 16:15:17 +00:00
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
|
||||
nMaxLen = math.max(string.len(sItem) + 1, nMaxLen)
|
||||
end
|
||||
local w = term.getSize()
|
||||
local nCols = math.floor(w / nMaxLen)
|
||||
if #tDirs < nCols then
|
||||
for _ = #tDirs + 1, nCols do
|
||||
|
@ -69,7 +69,11 @@ Event.addRoutine(function()
|
||||
break
|
||||
end
|
||||
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)) })
|
||||
else
|
||||
socket:write({ false, "Invalid function: " .. data.fn })
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -13,6 +13,11 @@ Event.addRoutine(function()
|
||||
if api then
|
||||
local proxy = _G[api]
|
||||
|
||||
if not proxy then
|
||||
print('proxy: invalid API')
|
||||
return
|
||||
end
|
||||
|
||||
local methods = { }
|
||||
for k,v in pairs(proxy) do
|
||||
if type(v) == 'function' then
|
||||
|
Loading…
x
Reference in New Issue
Block a user