ferrisfox

CC fetcher

Apr 10th, 2021 (edited)
584
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. -- fetcher for scripts found at github.com/ferrisfox/ComputerCraftScripts
  2.  
  3. local tArgs = { ... }
  4.  
  5. local address = "ferrisfox/ComputerCraftScripts/master/main.lua"
  6. local cacheBuster = ("%x"):format(math.random(0, 2^30))
  7. local response = http.get("https://raw.github.com/"..address.."?cb="..cacheBuster, nil, true)
  8. if not response then
  9.     print( "Fail" )
  10.     return nil
  11. end
  12.  
  13. local func, err = load(response.readAll(), "main.lua", "t", _ENV)
  14. if not func then
  15.     printError(err)
  16.     return
  17. end
  18.  
  19. local ok err = pcall(func, table.unpack(tArgs))
  20. if not ok then
  21.     printError( err )
  22. end
  23.  
  24. return
  25.  
Add Comment
Please, Sign In to add comment