This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
codyteen's profile picture

[Error] bit:40: bad argument: double expected, got nil

Started by codyteen, 17 April 2012 - 03:14 AM
codyteen #1
Posted 17 April 2012 - 05:14 AM
im getting the error
bit:40: bad argument: double expected, got nil

while true do
rin=rs.getBundledInput("back")
rin1=rs.getBundledInput("right")
rin2=rs.getBundledInput("left")
rin3=rs.getBundledInput("top")
if(colors.test(rin,colors.white)) then
print("1")
os.sleep(.5)
end
if(colors.test(rin,colors.orange)) then
print("2")
os.sleep(.5)
end
if(colors.test(rin,colors.magenta)) then
print("3")
os.sleep(.5)
end
if(colors.test(rin,colors.lightBlue)) then
print("4")
os.sleep(.5)
end
if(colors.test(rin,colors.yellow)) then
print("5")
os.sleep(.5)
end
if(colors.test(rin,colors.lime)) then
print("6")
os.sleep(.5)
end
if(colors.test(rin,colors.pink)) then
print("7")
os.sleep(.5)
end
if(colors.test(rin,colors.gray)) then
print("8")
os.sleep(.5)
end
if(colors.test(rin,colors.lightGray)) then
print("9")
os.sleep(.5)
end
if(colors.test(rin,colors.cyan)) then
print("10")
os.sleep(.5)
end
if(colors.test(rin,colors.purple)) then
print("11")
os.sleep(.5)
end
if(colors.test(rin,colors.blue)) then
print("12")
os.sleep(.5)
end
if(colors.test(rin,colors.brown)) then
print("13")
os.sleep(.5)
end
if(colors.test(rin,colors.green)) then
print("14")
os.sleep(.5)
end
if(colors.test(rin,colors.red)) then
print("15")
os.sleep(.5)
end
if(colors.test(rin,colors.black)) then
print("16")
os.sleep(.5)
end
if(colors.test(rin1,colors.white)) then
print("17")
os.sleep(.5)
end
if(colors.test(rin1,colors.orange)) then
print("18")
os.sleep(.5)
end
if(colors.test(rin1,colors.magenta)) then
print("19")
os.sleep(.5)
end
if(colors.test(rin1,colors.lightBlue)) then
print("20")
os.sleep(.5)
end
if(colors.test(rin1,colors.yellow)) then
print("21")
os.sleep(.5)
end
if(colors.test(rin1,colors.lime)) then
print("22")
os.sleep(.5)
end
if(colors.test(rin1,colors.pink)) then
print("23")
os.sleep(.5)
end
if(colors.test(rin1,colors.gray)) then
print("24")
os.sleep(.5)
end
if(colors.test(rin1,colors.lightGray))then
print("25")
os.sleep(.5)
end
if(colors.test(rin1,colors.cyan)) then
print("26")
os.sleep(.5)
end
if(colors.test(rin1,colors.purple)) then
print("27")
os.sleep(.5)
end
if(colors.test(rin1,colors.blue)) then
print("28")
os.sleep(.5)
end
if(colors.test(rin1,colors.brown)) then
print("29")
os.sleep(.5)
end
if(colors.test(rin1,colors.green)) then
print("30")
os.sleep(.5)
end
if(colors.test(rin1,colors.red)) then
print("31")
os.sleep(.5)
end
if(colors.test(rin1,colors.black)) then
print("32")
os.sleep(.5)
end
if(colors.test(rin2,colors.white)) then
print("33")
os.sleep(.5)
end
if(colors.test(rin2,colors.orange)) then
print("34")
os.sleep(.5)
end
if(colors.test(rin2,colors.magenta)) then
print("35")
os.sleep(.5)
end
if(colors.test(rin2,colors.lightBlue)) then
print("36")
os.sleep(.5)
end
if(colors.test(rin2,colors.yellow)) then
print("37")
os.sleep(.5)
end
if(colors.test(rin2,colors.lime)) then
print("38")
os.sleep(.5)
end
if(colors.test(rin2,colors.pink)) then
print("39")
os.sleep(.5)
end
if(colors.test(rin2,colors.gray)) then
print("40")
os.sleep(.5)
end
if(colors.test(rin2,colors.lightgray)) then
print("41")
os.sleep(.5)
end
if(colors.test(rin2,colors.cyan)) then
print("42")
os.sleep(.5)
end
if(colors.test(rin2,colors.purple)) then
print("43")
os.sleep(.5)
end
if(colors.test(rin2,colors.blue)) then
print("44")
os.sleep(.5)
end
if(colors.test(rin2,colors.brown)) then
print("45")
os.sleep(.5)
end
if(colors.test(rin2,colors.green)) then
print("46")
os.sleep(.5)
end
if(colors.test(rin2,colors.red)) then
print("47")
os.sleep(.5)
end
if(colors.test(rin2,colors.black)) then
print("48")
os.sleep(.5)
end
if(colors.test(rin3,colors.white)) then
print("49")
os.sleep(.5)
end
if(colors.test(rin3,colors.orange)) then
print("50")
os.sleep(.5)
end
if(colors.test(rin3,colors.magenta)) then
print("51")
os.sleep(.5)
end
if(colors.test(rin3,colors.lightBlue)) then
print("52")
os.sleep(.5)
end
if(colors.test(rin3,colors.yellow)) then
print("53")
os.sleep(.5)
end
if(colors.test(rin3,colors.lime)) then
print("54")
os.sleep(.5)
end
if(colors.test(rin3,colors.pink)) then
print("55")
os.sleep(.5)
end
if(colors.test(rin3,colors.gray)) then
print("56")
os.sleep(.5)
end
if(colors.test(rin3,colors.lightgray)) then
print("57")
os.sleep(.5)
end
if(colors.test(rin3,colors.cyan)) then
print("58")
os.sleep(.5)
end
if(colors.test(rin3,colors.purple)) then
print("59")
os.sleep(.5)
end
if(colors.test(rin3,colors.blue)) then
print("60")
os.sleep(.5)
end
if(colors.test(rin3,colors.brown)) then
print("61")
os.sleep(.5)
end
if(colors.test(rin3,colors.green)) then
print("62")
os.sleep(.5)
end
if(colors.test(rin3,colors.red)) then
print("63")
os.sleep(.5)
end
if(colors.test(rin3,colors.black)) then
print("64")
os.sleep(.5)
end
end
Luanub #2
Posted 17 April 2012 - 05:59 AM
The only thing I see that is wrong or could be wrong is your if statements. you have an extra un-needed set of ()'s in it.


if(colors.test(rin3,colors.black)) then


should be

if colors.test(rin3,colors.black) then

colors.test is not always the best route to take either, testing the Bundled Input seems to work better and produces less errors I would personally do


if rs.testBundledInput("side", colors.black) then
codyteen #3
Posted 17 April 2012 - 06:01 AM
ok thx now i got to re code it all thx :)/>/>
Wolvan #4
Posted 17 April 2012 - 08:13 AM
ok thx now i got to re code it all thx :)/>/>
Just use notepad(++)'s replace function
Hawk777 #5
Posted 19 April 2012 - 07:43 AM
Lua is case sensitive. "colors.lightgray" should be "colors.lightGray".