From 154d9676ab8ba98a448462d9f68ec42975ba42d7 Mon Sep 17 00:00:00 2001 From: 20kdc Date: Wed, 30 May 2018 16:45:24 +0100 Subject: [PATCH] Fix more metamachine bugs... --- repository/apps/app-metamachine.lua | 14 +++++++++----- repository/data/app-claw/local.lua | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/repository/apps/app-metamachine.lua b/repository/apps/app-metamachine.lua index c5d6a14..1bae1f0 100644 --- a/repository/apps/app-metamachine.lua +++ b/repository/apps/app-metamachine.lua @@ -124,8 +124,8 @@ vmComponent = { return tk end, invoke = function (com, me, ...) - if not components[com] then error("no component " .. com) end - if not components[com][me] then error("no method " .. com .. "." .. me) end + if not components[com] then error("no such component") end + if not components[com][me] then error("no such method") end return components[com][me](...) end, proxy = function (com) @@ -148,8 +148,11 @@ vmComponent = { return components[com].type end, methods = function (com) + if not components[com] then + return nil, "no such component" + end local mt = {} - for k, v in pairs(components[address]) do + for k, v in pairs(components[com]) do if type(v) == "function" then mt[k] = true end @@ -164,10 +167,10 @@ vmComponent = { end, doc = function (address, method) if not components[address] then - error("No such component " .. address) + error("no such component") end if not components[address][method] then - error("No such method " .. method) + return end return tostring(components[address][method]) end @@ -381,6 +384,7 @@ vmEnvironment = { -- This is not exactly the same, but is very similar, to that of machine.lua, -- differing mainly in how pullSignal timeout scheduling occurs. coroutine = { + -- NOTE: I can't give you a definitive list from OC because OC (or OpenOS?) screws up a metatable! yield = function (...) return coroutine.yield(nil, ...) end, diff --git a/repository/data/app-claw/local.lua b/repository/data/app-claw/local.lua index c22b131..b627201 100644 --- a/repository/data/app-claw/local.lua +++ b/repository/data/app-claw/local.lua @@ -108,7 +108,7 @@ return { }, ["app-metamachine"] = { desc = "Virtual machine", - v = 1, + v = 2, deps = { "neo", "zzz-license-pd"