Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function toboolean(a)
- if a == "true" or a == "1" or a == 1 then
- b = true
- return b
- elseif a == "false" or a == "0" or a == 0 then
- b = false
- return b
- else
- return "notbool"
- end
- end
- function emmit(side,bool,time)
- bool = tostring(bool)
- boolean = toboolean(bool)
- if boolean == "notbool" then
- error(bool.." is not a boolean")
- else
- if boolean == true then
- otherbool = false
- else
- otherbool = true
- end
- rs.setOutput(side,boolean)
- if time then
- time = tonumber(time)
- sleep(time)
- rs.setOutput(side,otherbool)
- end
- end
- end
- function passEmmit(side,bool,time,pass,cormess,falmess)
- write("Password: ")
- input = read("*")
- if input == pass then
- if cormess then
- x,y = term.getCursorPos()
- y = y + 1
- term.setCursorPos(1,y)
- print(cormess)
- end
- emmit(side,bool,time)
- else
- if falmess then
- x,y = term.getCursorPos()
- y = y + 1
- term.setCursorPos(1,y)
- print(falmess)
- end
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment