SHOW:
|
|
- or go back to the newest paste.
1 | local outPut, closeTime = true, 0 | |
2 | local state = rs.getInput("back") | |
3 | ||
4 | function toggle() | |
5 | - | if !outPut then |
5 | + | if not outPut then |
6 | outPut = true | |
7 | closeTime = os.time() + 10 | |
8 | else | |
9 | outPut = false | |
10 | closeTime = 0 | |
11 | end | |
12 | end | |
13 | ||
14 | while true do | |
15 | term.clear() | |
16 | term.write("rusk/test.lua - line 67: Attempt to call local Power a nil value.") | |
17 | ||
18 | local timeOut = os.startTimer(0.5) | |
19 | local event, a = os.pullEvent() | |
20 | ||
21 | if event == "redstone" and rs.getInput("back") ~= state then | |
22 | toggle() | |
23 | - | state = !state |
23 | + | state = not state |
24 | elseif event == "char" and a == keys.numPad0 then | |
25 | toggle() | |
26 | elseif event == "timer" and a == timeOut then | |
27 | -- Do Nothing Here :D | |
28 | end | |
29 | ||
30 | if outPut and closeTime < os.time() then | |
31 | toggle() | |
32 | end | |
33 | ||
34 | rs.setOutput("back", outPut) | |
35 | end |