fluid things
This commit is contained in:
parent
7694798ad0
commit
ad6af0fa35
21 changed files with 608 additions and 183 deletions
|
@ -1,3 +1,44 @@
|
|||
rednet.open("back")
|
||||
shell.run("report")
|
||||
--parallel.waitForAny(func1,func2)
|
||||
completion = require("cc.completion")
|
||||
local function splitprefixes(str,prefixes)
|
||||
for i,v in ipairs(prefixes) do
|
||||
if string.sub(str,1,string.len(v[2])) == v[2] then
|
||||
return v[2],string.sub(str,string.len(v[2])+2,string.len(str)),v[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
while true do
|
||||
thing = read( nil, nil,
|
||||
function(str)
|
||||
copy = require("rednetcopy")
|
||||
turts = copy.lookup("tomfoolery")
|
||||
turtlenames = {}
|
||||
--print(turts)
|
||||
for i,v in pairs(
|
||||
turts
|
||||
) do
|
||||
table.insert(turtlenames,v[2])
|
||||
end
|
||||
choices = completion.choice(str,turtlenames)
|
||||
--print(#choices)
|
||||
if #choices > 0 then
|
||||
return choices
|
||||
end
|
||||
|
||||
|
||||
name,sub,id = splitprefixes(str,turts)
|
||||
--print(name,sub,id)
|
||||
--print(sub)
|
||||
if not id then return end
|
||||
rednet.send(id,sub,"complete")
|
||||
_,message = rednet.receive("completed",0.2)
|
||||
return message
|
||||
end
|
||||
)
|
||||
turts = copy.lookup("tomfoolery")
|
||||
name, sub,id = splitprefixes(thing,turts)
|
||||
rednet.send(id,sub,"run")
|
||||
end
|
||||
--shell.run("report")
|
||||
|
||||
--parallel.waitForAny(func1,func2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue