1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-11-23 10:58:06 +11:00

Fix more metamachine bugs...

This commit is contained in:
20kdc 2018-05-30 16:45:24 +01:00
parent 3df5b6d3c9
commit 154d9676ab
2 changed files with 10 additions and 6 deletions

View File

@ -124,8 +124,8 @@ vmComponent = {
return tk return tk
end, end,
invoke = function (com, me, ...) invoke = function (com, me, ...)
if not components[com] then error("no component " .. com) end if not components[com] then error("no such component") end
if not components[com][me] then error("no method " .. com .. "." .. me) end if not components[com][me] then error("no such method") end
return components[com][me](...) return components[com][me](...)
end, end,
proxy = function (com) proxy = function (com)
@ -148,8 +148,11 @@ vmComponent = {
return components[com].type return components[com].type
end, end,
methods = function (com) methods = function (com)
if not components[com] then
return nil, "no such component"
end
local mt = {} local mt = {}
for k, v in pairs(components[address]) do for k, v in pairs(components[com]) do
if type(v) == "function" then if type(v) == "function" then
mt[k] = true mt[k] = true
end end
@ -164,10 +167,10 @@ vmComponent = {
end, end,
doc = function (address, method) doc = function (address, method)
if not components[address] then if not components[address] then
error("No such component " .. address) error("no such component")
end end
if not components[address][method] then if not components[address][method] then
error("No such method " .. method) return
end end
return tostring(components[address][method]) return tostring(components[address][method])
end end
@ -381,6 +384,7 @@ vmEnvironment = {
-- This is not exactly the same, but is very similar, to that of machine.lua, -- This is not exactly the same, but is very similar, to that of machine.lua,
-- differing mainly in how pullSignal timeout scheduling occurs. -- differing mainly in how pullSignal timeout scheduling occurs.
coroutine = { coroutine = {
-- NOTE: I can't give you a definitive list from OC because OC (or OpenOS?) screws up a metatable!
yield = function (...) yield = function (...)
return coroutine.yield(nil, ...) return coroutine.yield(nil, ...)
end, end,

View File

@ -108,7 +108,7 @@ return {
}, },
["app-metamachine"] = { ["app-metamachine"] = {
desc = "Virtual machine", desc = "Virtual machine",
v = 1, v = 2,
deps = { deps = {
"neo", "neo",
"zzz-license-pd" "zzz-license-pd"