Posted 22 May 2013 - 12:49 PM
Im having an issue with my CellDoor function. it says at line 40, but its really just whenever I call a function.
bios:338: [string "celldoor"]:40: 'end' expected (to close 'function' at line 39)
The program is supposed to display a menu, with 3 choices, open, close and exit.
with Open, it'll ask for a number of cells to open, then ask for the colors of the redpower wires for the doors, then one by one (cuz I cant think of how to use a table/array along with the redstone.setBundledCables function) anyways, one by one, the doors will open in the order he entered the colors.
Close will simply close all the doors, and Exit will reboot the PC.
About the Error:
Basically, its asking me for an 'end' after every time I call a function. I assume it thinks that Im declaring the function right there, instead of calling it. It happens at every function I try to call.
P.S. I was wondering if there is some switch operator that I don't know about, because the extended if else junk is tedious.
Thanks all and I hope this post was beneficial to my fellow nuebs. :)/>/>
bios:338: [string "celldoor"]:40: 'end' expected (to close 'function' at line 39)
The program is supposed to display a menu, with 3 choices, open, close and exit.
with Open, it'll ask for a number of cells to open, then ask for the colors of the redpower wires for the doors, then one by one (cuz I cant think of how to use a table/array along with the redstone.setBundledCables function) anyways, one by one, the doors will open in the order he entered the colors.
Close will simply close all the doors, and Exit will reboot the PC.
About the Error:
Basically, its asking me for an 'end' after every time I call a function. I assume it thinks that Im declaring the function right there, instead of calling it. It happens at every function I try to call.
function Open()
print("How Many Doors?")
doorNumber = read()
print("Which Colors?")
local i = 1
repeat
print(i,": ")
colorset.i = read()
i = i + 1
until i == doorNumber
print("Are you sure? (y/n)")
sure = read()
if sure == "n" then
function Open()
end
if sure == "y" then
for i = 1, doorNumber, 1 do
redstone.setBundledOutput("bottom", colorset.i)
end
else
print("enter y or n")
function Open()
end
end
function Menu()
print("Menu")
print("1. Open")
print("2. Close")
print("3. Exit")
selection = read()
if selection == 1 then
function Open()
else
if selection == 2 then
redstone.setBundledOutputs("bottom", 0)
else
if selection == 3 then
shell.run("reboot")
else
print("Enter 1-3 to make a selection.")
function Menu()
end
end
end
end
function Menu()
P.S. I was wondering if there is some switch operator that I don't know about, because the extended if else junk is tedious.
Thanks all and I hope this post was beneficial to my fellow nuebs. :)/>/>