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

[LUA] [ERROR] ACsln:55:Bad Arguement: number expect, got string

Started by Quinncunx, 29 June 2012 - 04:33 PM
Quinncunx #1
Posted 29 June 2012 - 06:33 PM
Making a program that would control a factory to automatically create computers, factory side works well, just trying to now program the bundled cable outputs based on the users input on how many they want making, though I keep getting this error:

ACsln:55:Bad Arguement: number expect, got string

I have tried several things to make this work, I get that it is basically saying I am trying to compare a number with a string, but as far as I can see all my numbers are numbers.

Any help would be appreciated.



print("How many computers would you like to build?")
local num = tonumber(read())
if num > 5 then
  print("Please input a smaller amount this time")
elseif input == 0 then
  print("please enter an amount")
elseif input == 1 then
  stonex = tonumber(7)
  redstonex = tonumber(1)
  glassx = tonumber(1)
  print("glassx")
elseif input == 2 then
  stonex = (14)
  redstonex = tonumber(2)
  glassx = tonumber(2)
elseif input == 3 then
  stonex = tonumber(21)
  redstonex = tonumber(3)
  glass = tonumber(3)
elseif input == 4 then
  stonex = tonumber(28)
  redstonex =tonumber(4)
  glass = tonumber(4)
else
  stonex = tonumber(35)
  redstonex = tonumber(5)
  glassx = tonumber(5)
end
for i=1,tonumber(redstonex),1 do
rs.setBundledOutput("back", "color.red")
sleep(0.5)
redstone.setBundledOutput(sSide, 0)
  for j=1,glassx,1 do
   rs.setBundledOutput("back", "color.white")
   sleep(0.5)
   redstone.setBundledOutput(sSide, 0)
    for k=1,stonex,1 do
	 rs.setBundledOutput("back", "color.white")
	 sleep(0.5)
	 redstone.setBundledOutput(sSide, 0)
    end
  end
end
Pinkishu #2
Posted 29 June 2012 - 06:50 PM
its colors.white
colors.red

not "color.white" or "color.red"
Quinncunx #3
Posted 29 June 2012 - 07:02 PM
Thanks for that, Now it seems to just be freezing but thats a new 24 hours of looking at it before I ask for help :P/>/>