This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
dazlaa's profile picture

[Help] Function problem

Started by dazlaa, 25 September 2012 - 02:43 PM
dazlaa #1
Posted 25 September 2012 - 04:43 PM
Hello,

Im new to programing in lua but I made a few simple programs like password locks

My problem is that I tried to make a function but it failed
Here is how it looks like:

function rsOut(var, time)
redstone.setOutput("var" , true)
sleep(time)
redstone.setOutput("var", false)
end

rsOut(left, 5)

But after this it fails

So can Any one help me please
sjele #2
Posted 25 September 2012 - 04:56 PM

function rsOut(var, time)
redstone.setOutput(var , true) --Remove the "'s around var
sleep(time)
redstone.setOutput(var, false) --Same as above
end
rsOut(left, 5)

I fixed it and noted what was wrong above in the code
dazlaa #3
Posted 25 September 2012 - 08:17 PM
Thanks it works now