Jump to content




[Lua] bios:133: Expected number


6 replies to this topic

#1 W00dyR

  • Members
  • 135 posts

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!

#2 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

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

#3 W00dyR

  • Members
  • 135 posts

Posted 02 January 2013 - 02:12 AM

View PostremiX, on 02 January 2013 - 02:06 AM, said:

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 :/

#4 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

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?

#5 W00dyR

  • Members
  • 135 posts

Posted 02 January 2013 - 02:31 AM

View PostOrwell, on 02 January 2013 - 02:18 AM, said:

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

#6 1234Daan

  • New Members
  • 1 posts

Posted 20 August 2013 - 05: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

#7 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 20 August 2013 - 05:14 AM

View Post1234Daan, on 20 August 2013 - 05:11 AM, said:

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users