Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArg = { ... }
- --variables
- local rSide = "bottom"
- local rInput = "not set"
- local rState = "off"
- --predeclare
- local printUsage
- local getState
- --functions--
- function getState()
- if redstone.getOutput(rSide,false) then
- rState = "Spawner Active."
- return
- elseif redstone.getOutput(rSide,true) then
- rState = "Spawner Inactive."
- return
- else
- print( "Redstone GetState Error." )
- return
- end
- end
- function printUsage()
- print( "Usage: spawner <on/off/current>" )
- return
- end
- local rInput = tArg[1]
- --start--
- if #tArg <1 then
- printUsage()
- return
- elseif rInput == "on" then
- redstone.setOutput(rSide,false)
- print( "Spawner now active." )
- return
- elseif rInput == "off" then
- redstone.setOutput(rSide,true)
- print( "Spawner now inactive." )
- return
- elseif rInput == "current" then
- getState()
- print( rState )
- return
- else
- print("Error.")
- printUsage()
- end
Add Comment
Please, Sign In to add comment