motor = peripheral.wrap("right")
repeat
RPM = motor.getSpeed()
print("current rpm is ", RPM, "RPM. What RPM do you need?")
setrpm = tonumber(io.read())
if type(setrpm) == "number"
then
motor.setSpeed(setrpm)
goto contine
else
print("Must be a number between -256 and 256")
print("current rpm is ", RPM, "RPM. What RPM do you need?")
setrpm = tonumber(io.read())
end
::continue::
rpm = motor.getSpeed()
su = ( rpm * 16)
fe = motor.getEnergyConsumption()
print("You have set speed " , rpm, " RPM")
print("Current stress cap is now ", su, "SU")
print("Power Consumption is now ", fe, "FE/t")
until( fe > 100 )
end
Expected behavor loop until fe=100 or more
current behavor motor.lua:12 '=' expected near 'continue'
writing a loop of code in computercraft to ask what rpm a block needs to spin at, expected behavor is to keep looping the code endlessly till the FE>100 (for the block its looking at its imposible)
continuein thegotostatement, also most importantly thatgotodoes absolutely nothing and usinggotoin general is a code smell.gotooperator in this Lua version.