Advertisement
1_F0

Untitled

Jul 19th, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. local terminal = {}
  2. local modules = {}
  3.  
  4. local gui = oh.gui
  5. local assets = oh.assets
  6.  
  7. local body = gui.Base.Body
  8. local window = body.Terminal
  9. local input = window.Input
  10. local output = window.Output
  11.  
  12. terminal.output = function(prefix, color, content)
  13.  
  14. end
  15.  
  16. terminal.command_handler = function()
  17. local parameters = {}
  18. local raw = input.Text:split(' ')
  19. local module = raw[1]
  20. local command = raw[2]
  21.  
  22. if not modules[module] or not modules[module][command] then
  23. terminal.output("OH", Color3.fromRGB(200, 0, 0), "Invalid command")
  24. return
  25. end
  26.  
  27. for i = 3, #raw do
  28. table.insert(parameters, raw[i])
  29. end
  30.  
  31. modules[module][command](unpack(parameters))
  32. end
  33.  
  34. terminal.add_component = function(module)
  35. modules[module.prefix] = {}
  36.  
  37. for i,v in next, module do
  38. if type(v) == "function" then
  39. modules[module.prefix][i] = v
  40. end
  41. end
  42. end
  43.  
  44. return terminal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement