Guest User

cmd

a guest
Aug 3rd, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. function terminal()
  2.   local cmd
  3.   write("Lavapump-MCU>")
  4.   cmd = read()
  5.   return cmd
  6. end  
  7. function process()
  8.   while true do
  9.     local ccmdipt = terminal()
  10.     local command = {}
  11.     local loop = 1
  12.       for cmd in string.gmatch(ccmdipt, "%a+") do
  13.         local command[loop] = cmd
  14.         loop = loop + 1
  15.       end  
  16.       if command[1] == "cmd1" then
  17.         --do stuff
  18.         write("cmd1")
  19.       elseif command[1] == "cmd2" then
  20.         --do stuff
  21.       else
  22.         print("Unknow command type help <command> for help")
  23.       end      
  24.   end
  25. end
  26. process()
Advertisement
Add Comment
Please, Sign In to add comment