Hello everyone. I am new to computercraft and like everyone else, I wanted to make a lua code that builds a house (actually just a box).
I am not new to coding, but even if I spend hours thinking and rewriting about it, it still didn't work.

I have a loop that continues until the given X value. But you know, corners are making it hard. So I wanted the turtle to not move any further if it is in the last spot. My code was something like this:

Spoilerz is Height input (z = io.read())
x and y is the x and y input (same input as above)
for k=1,z do  --Wall construction
for j=1,2 do  --2 times L shape
for i=1,x do  --X loop
turtle.placeDown()
if i~=x then  --The problem occurs in here. This comparison doesnt work. It always moves forward so it makes 1 more step forward making the house 1 block bigger.

turtle.forward()
end
end
turtle.turnLeft()
for i=1,y do  --Y loop
turtle.placeDown()
if i~=y then  --Same as above.
turtle.forward()
end
end
turtle.turnLeft()
end
if k~=z then
turtle.up()
end
end
This is only a part of my whole code.

I'm new to Lua. I worked with it before once but I am still remembering most of it. I am using the web book of it. Please can you help guys? Thank you very much.



Edit: I guess the problem is x, y and z are strings when called. Do I need to convert them to numbers with tonumber()?

Edit 2: Okay, I guess that was the problem. Sorry about making a topic. A moderator can delete this now. Thanks.