Ov0sh

load

May 3rd, 2022 (edited)
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. -- https://github.com/kikito/inspect.lua/blob/master/inspect.lua
  2. local shell = require("shell")
  3.  
  4. local arg,ops = shell.parse(...)
  5. print(ops["r"])
  6. if arg[1]==nil then
  7.   set = io.open("set","r")
  8.   arg[1]=set:read()
  9. else
  10.   set = io.open("set","w")
  11.   set:write(arg[1])
  12. end
  13. local internet = require("internet")
  14.  
  15. local handle = internet.request("http://192.168.31.38:3000/programs/"..arg[1])
  16. local result = ""
  17. for chunk in handle do result = result..chunk end
  18. -- Print the body of the HTTP response
  19. file = io.open(arg[1],"w")
  20. file:write(result)
  21. file:close()
  22. if ops["r"] then
  23.   shell.execute(arg[1])
  24. end
Advertisement
Add Comment
Please, Sign In to add comment