error handling

This commit is contained in:
kepler155c@gmail.com 2018-02-06 08:45:43 -05:00
parent cceb6c8409
commit f16c7b632b
3 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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