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

[Lua] bios:133: Expected number

Started by W00dyR, 02 January 2013 - 12:24 AM
W00dyR #1
Posted 02 January 2013 - 01:24 AM
Hey, I am currently working on a program that will dig a room for me. Now when I try test run the first 2 parts (width and height), I get the bios:133: Expected number error and I can't seem to figure out why this is happening.

My code so far:

print("-- Banana Room --")
local args = {...}
if #args < 3 then
print("Syntax: room <length> <width> <height>")
return
end
x = tonumber(args[1]) -- length
y = tonumber(args[2]) -- width
z = tonumber(args[3]) -- height
for i=1, y do
while turtle.detect() do
  turtle.dig()
  sleep(1)
end
for i=1, z do
  while turtle.detectUp() do
   turtle.digUp()
   sleep(1)
  end
  turtle.up()
end
for i=1, z do
  turtle.down()
end  
turtle.forward()
end
for i=1, y do
turtle.back()
end

Thanks ahead!
remiX #2
Posted 02 January 2013 - 02:06 AM
Hmm, I don't see why it's giving an expected number error, are you typing a proper number for each argument?

And what's the full error? If I'm not mistaken, it should be something like this:
bios:133 (programName:line) expected number, got string
W00dyR #3
Posted 02 January 2013 - 02:12 AM
Hmm, I don't see why it's giving an expected number error, are you typing a proper number for each argument?

And what's the full error? If I'm not mistaken, it should be something like this:
bios:133 (programName:line) expected number, got string

Im giving it a proper number yes, the program is called "room", and the command im giving it is "room 3 4 2" for example. It does the spot its standing on correctly but it then mines a single block on the next spot, then it gives "bios:133: Expected number". That is the full error :/
Orwell #4
Posted 02 January 2013 - 02:18 AM
It is an error in the sleep() function. It seems that you're calling it somewhere with a non-number as parameter. Are you sure you didn't type 'l' (L) instead of 1 in one of the calls to sleep?
W00dyR #5
Posted 02 January 2013 - 02:31 AM
It is an error in the sleep() function. It seems that you're calling it somewhere with a non-number as parameter. Are you sure you didn't type 'l' (L) instead of 1 in one of the calls to sleep?

Ahh that seemed to be the problem, a simple typo, there wasnt any number in the first sleep(). Thanks :P/>
1234Daan #6
Posted 20 August 2013 - 06:11 AM
I am getting the same exact error, although I have checked my 'sleep() ' functions and they all look just fine. Could anyone have a look at my code and help me? It is vor a secret staircase powered by 8 different frame motors. http://pastebin.com/1A5BrS1q
immibis #7
Posted 20 August 2013 - 06:14 AM
I am getting the same exact error, although I have checked my 'sleep() ' functions and they all look just fine. Could anyone have a look at my code and help me? It is vor a secret staircase powered by 8 different frame motors. http://pastebin.com/1A5BrS1q
Anything in quotes is a string. Strings are not numbers.