eeproms
This commit is contained in:
@@ -1,11 +1,35 @@
|
||||
print(component.doc("debugPrint", "log"))
|
||||
print(component.invoke("debugPrint", "log", "Absolute cinema"))
|
||||
-- sandbox stuff
|
||||
|
||||
computer.pushSignal("stuff", 123, "a", false, nil)
|
||||
computer.pushSignal("stuf2", 456, "b", true, "shit")
|
||||
computer.pushSignal("stuf3", 789, "c", false, -13)
|
||||
local clist = component.list
|
||||
function component.list(type, exact)
|
||||
local m = clist()
|
||||
if not type then return m end
|
||||
local t = {}
|
||||
for addr, kind in pairs(m) do
|
||||
if exact then
|
||||
if type == kind then
|
||||
t[addr] = kind
|
||||
end
|
||||
else
|
||||
if string.match(kind, type) then
|
||||
t[addr] = kind
|
||||
end
|
||||
end
|
||||
end
|
||||
setmetatable(t, {
|
||||
__call = function()
|
||||
return next(t)
|
||||
end,
|
||||
})
|
||||
return t
|
||||
end
|
||||
|
||||
print(computer.popSignal())
|
||||
print(computer.popSignal())
|
||||
print(computer.popSignal())
|
||||
print(computer.popSignal())
|
||||
for addr, kind in pairs(component.list()) do
|
||||
if kind == "eeprom" then
|
||||
local data = component.invoke(addr, "get")
|
||||
assert(load(data, "=eeprom"))()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
error("no bios")
|
||||
|
||||
Reference in New Issue
Block a user