9551

button file loader

Aug 2nd, 2021 (edited)
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. _G.runBTN = function(e, t, a, ...)_G.require = _ENV.require if not
  2. fs.exists("button")then shell.run("pastebin get LTDZZZEJ button")end e = e or ""if
  3. e:match("%.(.-)$") ~= "btn"then error("not a button file", 0)end if not
  4. fs.exists(e)then error("no such file", 0)end if t ~= "terminal" and
  5. t ~= "monitor"then
  6. error("invalid button type !. should be monitor/terminal", 0)end if
  7. type(a) ~= "string"then error("empty button variable!. should be a string", 0)end
  8. _G[a] = require("button")[t]local o = {}for i in io.lines(e)do o[#o + 1] = i end local
  9. n = loadstring(table.concat(o, " "))while true do local s, h = pcall(n, ...)if not s
  10. then error("button program has crashed. reason:\n" .. h, 0)end end
  11. end
Add Comment
Please, Sign In to add comment