Posted 11 August 2013 - 08:26 AM
Title[Open Peripherals] function only works once
This function works perfectly..once, after it fires once whatever I put in for object will return nil if
function changeBoxHeight(desiredHeightChange, object, speed, direction)
local boxWidth = object.getWidth();
local boxHeight = object.getHeight();
local boxX = object.getX();
local boxY = object.getY();
print(object.getHeight());
for i = 1, desiredHeightChange/5 do
object.delete();
if direction == "up" then
object = net.addBox(boxX, boxY, boxWidth, boxHeight - 5*i, 0xFFFFFF, 0.5);
end
if direction == "down" then
object = net.addBox(boxX, boxY, boxWidth, boxHeight + 5*i, 0xFFFFFF, 0.5);
end
sleep(speed);
end
end
This function works perfectly..once, after it fires once whatever I put in for object will return nil if
variable.getHeight();
is asked of it. Any idea what I did wrong?