Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("Apnet")
- Apnet.Initialize()
- local function getTokens(str)
- local result = {}
- local i = o
- for token in string.gmatch(str, "%S") do
- i = i + 1
- result[i] = token
- end
- result.count = i
- return result
- end
- local function inputLoop()
- local string input = "default"
- while (input ~= "exit") do
- print("Enter a command")
- input = read()
- local tokens = getTokens(input)
- processInput(tokens)
- end
- end
- local function processInput(tokens)
- if (tokens[1] == "ping") then
- local cId = tokens[2]
- local cLabel = tokens[3]
- local cType = tokens[4]
- local msg = Apnet.NewMessage()
- msg.MessageType = Apnet.MSG_TYPE_SYSTEM
- msg.MessageSubType = Apnet.MSG_SUBTYPE_PING
- msg.Destination.ComputerId = cId
- msg.Destination.ComputerLabel = cLabel
- msg.Destination.ComputerType = cType
- Apnet.Send(msg)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement