Posted 06 December 2016 - 06:24 AM
Hi! I would like a little help in calling functions from a separate file. I have done a lot of reading on the subject but to be honest the documentation for lua I have found is a little confusing. Any help I can get in clearing this up would be great. Thank you for your time.
mineFuncts file:
miner. (main file) – When ran I get attept to call nill line 1.
problem seems to be with the require statement as I get the same error whether or not the function call miner.stairMaker() is in the code.
miner.stairMaker()
mineFuncts file:
function stairMaker()
print("Current Y Level?:: ")
local yLevel= io.read()
local digCounter = yLevel - 12
local loopCounter = 0
while loopCounter < digCounter do
turtle.digDown()
turtle.down()
loopCounter = loopCounter + 1
turtle.dig()
while not turtle.forward() do
turtle.dig()
sleep(0.1)
end
turtle.digUp()
end
end
function shaftMaker()
--future code
end
miner. (main file) – When ran I get attept to call nill line 1.
problem seems to be with the require statement as I get the same error whether or not the function call miner.stairMaker() is in the code.
miner = require("minerFuncts")
miner.stairMaker()