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!
2088 posts
Location
South 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
135 posts
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 :/
1054 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?
135 posts
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/>
1 posts
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
997 posts
Location
Wellington, New Zealand
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.