26 lines
628 B
Lua
26 lines
628 B
Lua
local options = { "left", "control", "right" }
|
|
local prompt = "What computer is to be setup? select: (" .. table.concat(options, " ") .. ") with up/down arrows"
|
|
io.output("settings.json")
|
|
|
|
function table.contains(table, element)
|
|
for _, value in pairs(table) do
|
|
if value == element then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function setup(role)
|
|
local jsonOutput = textutils.serialiseJSON({ ["role"] = role })
|
|
io.write(jsonOutput)
|
|
end
|
|
|
|
while true do
|
|
print(prompt)
|
|
local input = read(nil, options)
|
|
if table.contains(options, input) then
|
|
setup(input)
|
|
end
|
|
end
|