fyrkantis

Adview

Nov 4th, 2026 (edited)
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.55 KB | None | 0 0
  1. -- adview.lua (minified), built from the adpaint sources.
  2. package.preload["lib.cli"]=function(...)local a={}function a.isHelp(b)return b=="help"or b=="-h"or b=="--help"or b=="-?"end function a.registerCompletion(b)if shell.setCompletionFunction then shell.
  3. setCompletionFunction(shell.getRunningProgram(),b)end end function a.completion()local b,c=pcall(require,"cc.shell.completion")return b and c or nil end function a.addChoices(b,c)for e,d in ipairs(c)
  4. do b[#b+1]=d end return b end function a.setup(e,h,f)local c=("shell.run(%q, \"--register\") %s"):format("/"..shell.getRunningProgram(),e)local b for g,d in ipairs({"/startup.lua","/startup"})do if fs
  5. .exists(d)and not fs.isDir(d)then b=d;break end end if b then local d=a.readFile(b,"r")or""if d:find(e,1,true)then print("Already set up in "..b);return end local g=fs.open(b,"a")g.write((d:sub(-1)==
  6. "\n"or d=="")and c.."\n"or"\n"..c.."\n")g.close()else b=h local d=fs.open(b,"w")d.write(c.."\n")d.close()end print("Added completion to "..b..".")if f then print(f)end end function a.readFile(c,d)
  7. local b=fs.open(c,d or"rb")if not b then return nil end local e=b.readAll()or""b.close()return e end function a.yielder(c)local d=os.epoch("utc")return function()if os.epoch("utc")-d>2000 then os.
  8. queueEvent("adpaint_yield")while true do local b={os.pullEventRaw()}if b[1]=="adpaint_yield"then break elseif b[1]=="terminate"then error("Terminated",0)elseif c then c(b)end end d=os.epoch("utc")end
  9. end end return a end package.preload["lib.displays"]=function(...)local e=require("lib.formats.adimg")local a={}local f,g,j=math.floor,math.max,math.min a.SCALES={0.5,1,1.5,2,2.5,3,3.5,4,4.5,5}
  10. function a.isMonitor(b)if peripheral.hasType then return peripheral.hasType(b,"monitor")==true end return peripheral.getType(b)=="monitor"end function a.naturalLess(c,d)local function b(h)return(h:
  11. gsub("%d+",function(i)return("%012d"):format(tonumber(i))end))end return b(c)<b(d)end function a.adjacentNames()local b={}for d,c in ipairs(redstone.getSides())do if a.isMonitor(c)then b[#b+1]=c end
  12. end return b end function a.networkNames()local d,b={},{}for h,c in ipairs(redstone.getSides())do d[c]=true end for h,c in ipairs(peripheral.getNames())do if not d[c]and a.isMonitor(c)then b[#b+1]=c
  13. end end table.sort(b,a.naturalLess)return b end function a.find(c)local h,k={},{}local function i(b,l)local m=b=="term"or b=="terminal"if m then b="terminal"end local d=k[b]if d then if l then d.
  14. number=l end return true end if m then d={name=b,out=term.current(),isMonitor=false}elseif a.isMonitor(b)then d={name=b,out=peripheral.wrap(b),isMonitor=true}else return false end d.number=l h[#h+1]=d
  15. k[b]=d return true end for d,b in ipairs(c.names or{})do if not i(b.name,b.number)then return nil,"No monitor called "..b.name end end if c.adjacent then for d,b in ipairs(a.adjacentNames())do i(b)end
  16. end if c.network then for d,b in ipairs(a.networkNames())do i(b)end end if#h==0 then if(c.adjacent or c.network)and#(c.names or{})==0 or c.noTerminal then return nil,"No monitors found."end i("term")
  17. end return h,k end function a.number(b,c)if c then for d,h in ipairs(b)do if c[d]and not h.number then h.number=c[d]end end end local d=0 for i,h in ipairs(b)do if not h.number then h.number=d+1 end d
  18. =g(d,h.number)end return b end function a.describe(d)local b={}for h,c in ipairs(d)do b[#b+1]=c.number..": "..c.name end return table.concat(b,", ")end function a.measure(c)if not c.isMonitor then
  19. return end local b={}pcall(function()for k,d in ipairs(a.SCALES)do c.out.setTextScale(d)local h,i=c.out.getSize()b[#b+1]={d,h,i}end end)if#b==0 then b[1]={0.5,1,1}end c.sizes=b end function a.
  20. chooseScale(b,m,n,k)local h,l for t=#b.sizes,1,-1 do local c=b.sizes[t]local o,p=c[2],c[3]local q=j(m,o)*j(n,p)local r,s=1-q/(m*n),1-q/(o*p)local i,d if k=="bars"then i,d=r==0,-c[1]elseif k=="fill"
  21. then i,d=s==0,c[1]else i,d=true,2*r+s end if i and(not l or d<l-1e-9)then h,l=c,d end end if not h then h=k=="bars"and b.sizes[1]or b.sizes[#b.sizes]end return h[1]end function a.textScale(c,d,h,i)for
  22. k=#c.sizes,1,-1 do local b=c.sizes[k]if b[2]>=d*(i or 1)and b[3]>=h+2 then return b[1]end end return 0.5 end function a.fitScale(c,d,h)local b=g(0.5,j(5,f(d*2+0.5)/2))while true do if c.getTextScale()
  23. ~=b then c.setTextScale(b)end if b<=0.5 or h(c.getSize())then return b end b=b-0.5 end end function a.edgeColour(c)local d,k,l={},"f",-1 local function h(b)d[b]=(d[b]or 0)+1;if d[b]>l then k,l=b,d[b]
  24. end end for b=1,c.h do local i=c.rows[b][3]if b==1 or b==c.h then for m=1,c.w do h(i:sub(m,m))end else h(i:sub(1,1));h(i:sub(-1))end end return k end function a.drawImage(d,b,t)local h=d.out if not b.
  25. rows then e.rowsFromPixels(b)end if d.isMonitor then if not d.sizes then a.measure(d)end h.setTextScale(a.chooseScale(d,b.w,b.h,t or"compromise"))end local i,k=h.getSize()local c=window.create(h,1,1,i
  26. ,k,false)e.applyPalette(c,b.palette)c.setBackgroundColour(2^e.HEX_TO_IDX[a.edgeColour(b)])c.clear()local l=f((i-b.w)/2)+1 local u=f((k-b.h)/2)+1 local q=l<1 and 1-l or 0 local r=b.composed or e.
  27. compose(b)b.composed=r for s=1,b.h do local m=u+s-1 if m>=1 and m<=k then local n=r[s]local o,p=q+1,q+i c.setCursorPos(g(1,l),m)c.blit(n[1]:sub(o,p),n[2]:sub(o,p),n[3]:sub(o,p))end end c.setVisible(
  28. true)end function a.drawText(c,d,l)local b=c.out local h=0 for k,i in ipairs(d)do h=g(h,#i)end if c.isMonitor then if not c.sizes then a.measure(c)end b.setTextScale(a.textScale(c,h,#d,2))end e.
  29. applyPalette(b)b.setBackgroundColour(colors.black)b.clear()local m,n=b.getSize()local o=f((n-#d)/2)+1 for i,k in ipairs(d)do b.setTextColour(i==1 and(l or colors.white)or colors.lightGray)b.
  30. setCursorPos(f((m-#k)/2)+1,o+i-1)b.write(k)end end function a.clear(b)e.applyPalette(b.out)b.out.setBackgroundColour(colors.black)b.out.setTextColour(colors.white)b.out.clear()b.out.setCursorPos(1,1)
  31. end function a.try(b,c,...)return(pcall(b,c,...))end return a end package.preload["lib.formats.adimg"]=function(...)local a={}a.VERSION=1 a.HEX="0123456789abcdef"a.B32=
  32. "0123456789abcdefghijklmnopqrstuv"a.DEFAULT_PALETTE={[0]=0xF0F0F0,0xF2B233,0xE57FD8,0x99B2F2,0xDEDE6C,0x7FCC19,0xF2B2CC,0x4C4C4C,0x999999,0x4C99B2,0xB266E5,0x3366CC,0x7F664C,0x57A64E,0xCC4C4C,0x111111
  33. ,}local x,y=a.HEX,a.B32 local e,z,E,f=string.sub,string.char,string.byte,table.concat local h=math.floor local o,p,q={},{},{}local j,g={},{}local t={}for b=0,31 do local d=e(y,b+1,b+1)o[d]=z(128+b)p[d
  34. ]=b q[b]=d local i,c=0,b while c>0 do i=i+c%2;c=h(c/2)end t[b]=i end for b=0,15 do local c=e(x,b+1,b+1)j[c]=b g[b]=c end a.B32_TO_CHAR,a.B32_TO_BITS,a.BITS_TO_B32=o,p,q a.HEX_TO_IDX,a.IDX_TO_HEX=j,g
  35. function a.new(d,i,c)c=c or 0 local b={w=d,h=i,pw=d*2,ph=i*3,px={},text={}}local k=b.px for l=1,b.pw*b.ph do k[l]=c end return b end function a.get(b,c,d)if c<0 or d<0 or c>=b.pw or d>=b.ph then return
  36. nil end return b.px[d*b.pw+c+1]end local function u(c,l,A,B)local d=B*3*l+A*2+1 local m,n=c[d],c[d+1]local r,s=c[d+l],c[d+l+1]local v,w=c[d+2*l],c[d+2*l+1]local i,k=w,w local b=0 if m~=i then k=m;b=b+
  37. 1 end if n~=i then k=n;b=b+2 end if r~=i then k=r;b=b+4 end if s~=i then k=s;b=b+8 end if v~=i then k=v;b=b+16 end return b,k,i end a.encodeCell=u function a.rowsFromPixels(b)local d={}local n,r=b.px,
  38. b.pw for i=0,b.h-1 do local k,l,m={},{},{}for c=0,b.w-1 do local s,v,w=u(n,r,c,i)k[c+1]=q[s];l[c+1]=g[v];m[c+1]=g[w]end d[i+1]={f(k),f(l),f(m)}end b.rows=d return d end function a.pixelsFromRows(b)
  39. local c,i={},b.w*2 b.pw,b.ph,b.px=i,b.h*3,c for s=0,b.h-1 do local r=b.rows[s+1]local v,w,A=r[1],r[2],r[3]for d=0,b.w-1 do local m=p[e(v,d+1,d+1)]or 0 local n=j[e(w,d+1,d+1)]or 0 local k=j[e(A,d+1,d+1
  40. )]or 15 local l=s*3*i+d*2+1 c[l]=m%2>=1 and n or k c[l+1]=m%4>=2 and n or k c[l+i]=m%8>=4 and n or k c[l+i+1]=m%16>=8 and n or k c[l+2*i]=m>=16 and n or k c[l+2*i+1]=k end end return c end function a.
  41. serialize(d)local i=a.rowsFromPixels(d)local b={"ADIMG "..a.VERSION,"size "..d.w.." "..d.h}if d.palette then local c={}for k=0,15 do c[#c+1]=string.format("%06x",d.palette[k])end b[#b+1]="palette "..f(
  42. c," ")end for l,c in ipairs(d.text)do b[#b+1]=string.format("text %d %d %s %s %d",c.x,c.y,g[c.fg],c.bg and g[c.bg]or"-",#c.lines)for m,k in ipairs(c.lines)do b[#b+1]=k end end b[#b+1]="data"for k,c in
  43. ipairs(i)do b[#b+1]=c[1];b[#b+1]=c[2];b[#b+1]=c[3]end b[#b+1]=""return f(b,"\n")end function a.parse(s,v)local d={}for b in(s:gsub("\r","").."\n"):gmatch("(.-)\n")do d[#d+1]=b end if not d[1]or not d[
  44. 1]:match("^ADIMG %d+")then return nil,"not an ADIMG file"end local b={text={},rows={}}local c=2 while c<=#d do local i=d[c]local k=i:match("^(%S+)")if k=="size"then local l,m=i:match(
  45. "^size (%d+) (%d+)")b.w,b.h=tonumber(l),tonumber(m)elseif k=="palette"then local m,l={},0 for n in i:gmatch("%x%x%x%x%x%x")do m[l]=tonumber(n,16);l=l+1 end if l==16 then b.palette=m end elseif k==
  46. "text"then local l,w,A,B,m=i:match("^text (%-?%d+) (%-?%d+) (%x) (%S) (%d+)")if not l then return nil,"bad text record on line "..c end local n={x=tonumber(l),y=tonumber(w),fg=j[A:lower()],bg=j[B:
  47. lower()],lines={}}for r=1,tonumber(m)do n.lines[r]=d[c+r]or""end b.text[#b.text+1]=n c=c+tonumber(m)elseif k=="data"then if not b.w then return nil,"missing size"end for r=1,b.h do local l,m,n=d[c+1]
  48. or"",d[c+2]or"",d[c+3]or""if#l~=b.w then l=(l..("0"):rep(b.w)):sub(1,b.w)end if#m~=b.w then m=(m..("0"):rep(b.w)):sub(1,b.w)end if#n~=b.w then n=(n..("f"):rep(b.w)):sub(1,b.w)end b.rows[r]={l,m,n}c=c+
  49. 3 end break end c=c+1 end if not b.w then return nil,"missing size"end b.pw,b.ph=b.w*2,b.h*3 if v then a.pixelsFromRows(b)end return b end function a.save(c,d)local i=a.serialize(c)local b,k=fs.open(d
  50. ,"wb")if not b then return nil,k end b.write(i)b.close()return true end function a.load(c,d)local b,i=fs.open(c,"rb")if not b then return nil,i end local k=b.readAll()or""b.close()return a.parse(k,d)
  51. end local function A(b,c,d,i)if b.bg then return g[b.bg]end return t[c]>3 and d or i end function a.compose(i,B)local l={}local v=i.rows for c=1,i.h do local b=v[c]l[c]={(b[1]:gsub(".",o)),b[2],b[3]}
  52. end if B==false or#i.text==0 then return l end local n={}for F,d in ipairs(i.text)do local r=1 for c,b in ipairs(d.lines)do if#b>r then r=#b end end for C,w in ipairs(d.lines)do local k=d.y+C-1 if k>=
  53. 1 and k<=i.h then local b=n[k]if not b then local m=v[k]b={{},{},{},bits={}}for c=1,i.w do local s=e(m[1],c,c)b.bits[c]=p[s]or 0 b[1][c]=o[s]or" "b[2][c]=e(m[2],c,c);b[3][c]=e(m[3],c,c)end n[k]=b end
  54. for s=1,d.bg and r or#w do local c=d.x+s-1 local m=e(w,s,s)if m==""then m=" "end if c>=1 and c<=i.w and(m~=" "or d.bg)then local D=A(d,b.bits[c],b[2][c],b[3][c])b[1][c]=m;b[2][c]=g[d.fg];b[3][c]=D end
  55. end end end end for c,b in pairs(n)do l[c]={f(b[1]),f(b[2]),f(b[3])}end return l end function a.draw(m,b,d,i,c)b=b or term d,i=d or 1,i or 1 c=c or a.compose(m)for l=1,#c do local k=c[l]b.setCursorPos(
  56. d,i+l-1)b.blit(k[1],k[2],k[3])end end function a.applyPalette(d,b)b=b or a.DEFAULT_PALETTE for c=0,15 do d.setPaletteColour(2^c,b[c])end end function a.rgb(b)return h(b/65536)%256,h(b/256)%256,b%256
  57. end function a.dist(m,n)local b,r,s=a.rgb(m)local c,v,w=a.rgb(n)local d,i,k=b-c,r-v,s-w local l=(b+c)/2 return(2+l/256)*d*d+4*i*i+(2+(255-l)/256)*k*k end function a.fitRect(l,m,d,i,k,r,s)if k~="fit"
  58. and k~="fill"then return d,i,0,0 end local n=(k=="fit"and math.min or math.max)(d/l,i/m)local b,c=math.max(1,h(l*n+0.5)),math.max(1,h(m*n+0.5))if k=="fit"then b,c=math.min(b,d),math.min(c,i)else b,c=
  59. math.max(b,d),math.max(c,i)end return b,c,h((d-b)*(r or 0.5)+0.5),h((i-c)*(s or 0.5)+0.5)end function a.copyText(i)local c={}for k,b in ipairs(i)do local d={}for l,m in ipairs(b.lines)do d[l]=m end c[
  60. k]={x=b.x,y=b.y,fg=b.fg,bg=b.bg,lines=d}end return c end return a end package.path="/"..fs.combine(fs.getDir(shell.getRunningProgram()),"?.lua")..";"..package.path local y=require("lib.formats.adimg")
  61. local b=require("lib.displays")local g=require("lib.cli")local H=math.floor local I=
  62. [[
  63. Usage:
  64.  adview <file|folder> ... [options]
  65. Displays (default: this terminal):
  66.  -m, --monitor <name>[=<n>]
  67.                   a monitor ("term" = terminal),
  68.                   optionally with its number;
  69.                   repeat or separate with commas
  70.  -a, --adjacent   add monitors next to the computer
  71.  -n, --network    add monitors on wired modems
  72.      --numbers <list>  numbers for the displays in
  73.                   order, e.g. 1,2,3,1,2,3
  74.      --identify   show each display's number
  75. Showing:
  76.      --mode <m>   compromise (default), bars, fill
  77.  -t, --time <s>   seconds per ad (10)
  78.  -o, --order <o>  random (default) or name
  79.  adview setup     completion at every boot
  80.  adview help      this text
  81.  
  82. Displays are numbered 1, 2, 3... in the order
  83. -m, adjacent, network, unless a number is given
  84. (-m top=2 or --numbers); one without gets the
  85. next number after the highest so far. Displays
  86. may share a number.
  87. In a folder every .adi file is an ad and every
  88. subfolder is one ad of several images: sorted by
  89. name, image 1 goes to display(s) 1, image 2 to
  90. display(s) 2, ... starting over when there are
  91. more displays than images. The folder is
  92. re-read after every ad, so files can be added,
  93. changed or removed while adview runs.
  94. Modes: bars shows the whole image (bars around
  95. it), fill covers the monitor (crops the image),
  96. compromise picks the scale with the least bars +
  97. cropping (cropping counts double).
  98. Ctrl+T stops (or Q on the terminal).]]
  99. local J={["-t"]=true,["--time"]=true,["--numbers"]=true}local K={"--monitor","--adjacent","--network","--numbers","--identify","--mode","--time","--order"}local function L(e,i,c,a)local d=g.completion(
  100. )if not d then return{}end local f=a[#a]if J[f]then return{}end if f=="-m"or f=="--monitor"then local h=d.peripheral(e,c,a,false)return g.addChoices(h,d.choice(e,c,a,{"term"},false))end if f=="--mode"
  101. then return d.choice(e,c,a,{"compromise","bars","fill"},true)end if f=="-o"or f=="--order"then return d.choice(e,c,a,{"random","name"},true)end if c:sub(1,1)=="-"then return d.choice(e,c,a,K,true)end
  102. local h={}if i==1 then g.addChoices(h,d.choice(e,c,a,{"help","setup"},true))end return g.addChoices(h,d.dirOrFile(e,c,a,true))end g.registerCompletion(L)local function M()g.setup(
  103. "-- adview: filename completion","/startup/adview-complete.lua")end local h={...}if h[1]=="--register"then return end if#h==0 or g.isHelp(h[1])then textutils.pagedPrint(I)return end if h[1]=="setup"
  104. then M();return end local d,i,j={},{},nil local z,A,s=false,false,false local k,n,o="compromise",10,"random"do local a=1 while a<=#h do local c,e=h[a],h[a+1]if c=="-m"or c=="--monitor"then if not e
  105. then printError(c.." needs a monitor name");return end for m in e:gmatch("[^,]+")do local l,f=m:match("^(.-)=(%d+)$")l=l or m f=tonumber(f)if f and f<1 then printError("Display numbers start at 1");
  106. return end i[#i+1]={name=l,number=f}end a=a+2 elseif c=="-a"or c=="--adjacent"then z=true;a=a+1 elseif c=="-n"or c=="--network"then A=true;a=a+1 elseif c=="--identify"then s=true;a=a+1 elseif c==
  107. "--numbers"then j={}for l in(e or""):gmatch("[^,%s]+")do local f=tonumber(l)if not f or f<1 or f~=H(f)then printError("--numbers needs a list like 1,2,3,1,2,3");return end j[#j+1]=f end if#j==0 then
  108. printError("--numbers needs a list like 1,2,3,1,2,3");return end a=a+2 elseif c=="--mode"then k=(e or""):lower()if k~="compromise"and k~="bars"and k~="fill"then printError(
  109. "--mode must be compromise, bars or fill");return end a=a+2 elseif c=="-t"or c=="--time"then n=tonumber(e)if not n or n<=0 then printError("--time needs a number of seconds");return end a=a+2 elseif c
  110. =="-o"or c=="--order"then o=(e or""):lower()if o~="random"and o~="name"then printError("--order must be random or name");return end a=a+2 elseif c:sub(1,1)=="-"then printError("Unknown option "..c);
  111. return else d[#d+1]=c;a=a+1 end end end if#i==0 and#d==2 and not fs.exists(shell.resolve(d[2]))and b.isMonitor(d[2])then i[1]={name=table.remove(d)}end if#d==0 and not s then printError(
  112. "No image given. See 'adview help'.");return end for c,a in ipairs(d)do if not fs.exists(shell.resolve(a))then printError("Not found: "..a);return end end local c,p=b.find({names=i,adjacent=z,network=
  113. A})if not c then printError(p);return end b.number(c,j)for e,a in ipairs(c)do b.try(b.measure,a)end local e=p.terminal local function l(a)if a.current then return b.try(b.drawImage,a,a.current,k)end
  114. return b.try(b.drawText,a,{"No image"},colors.white)end local function t()b.clear({out=term.current()})end local function u(m)local r=m and os.startTimer(m)while true do local a={os.pullEventRaw()}
  115. local f=a[1]if f=="timer"and a[2]==r then return true elseif f=="terminate"then return false elseif f=="key"and(e or not m)then if not m or a[2]==keys.q then return false end elseif f==
  116. "monitor_resize"and p[a[2]]then local q=p[a[2]]b.try(b.measure,q)l(q)elseif f=="term_resize"and e then l(e)end end end if s then for f,a in ipairs(c)do if a~=e then b.try(b.drawText,a,{tostring(a.
  117. number),a.name},colors.yellow)end end if not e then print("Displays: "..b.describe(c))print("Press any key to clear them.")else local a={"Displays"}for m,f in ipairs(c)do a[#a+1]=f.number..": "..f.
  118. name end b.drawText(e,a,colors.yellow)end u(nil)for f,a in ipairs(c)do if a.isMonitor then b.try(b.clear,a)end end if e then t()end return end local function B(a)return a:lower():match("%.adi$")~=nil
  119. end local function v(a)return fs.getName(a):lower().."\0"..a end local function N(a,f)return a.key<f.key end local function C(a)local f,m=pcall(fs.list,a)return f and m or{}end local function O()local
  120. f,r={},{}local function m(a,q)if r[a]then return end r[a]=true f[#f+1]={path=a,key=v(a),group=q}end for D,x in ipairs(d)do local a=shell.resolve(x)if fs.isDir(a)then for E,w in ipairs(C(a))do local q=
  121. fs.combine(a,w)if fs.isDir(q)then m(q,true)elseif B(w)then m(q,false)end end elseif fs.exists(a)then m(a,false)end end table.sort(f,N)return f end local function P(f)local a={}for r,m in ipairs(C(f))
  122. do local q=fs.combine(f,m)if B(m)and not fs.isDir(q)then a[#a+1]=q end end table.sort(a,function(m,q)return v(m)<v(q)end)return a end local m={}local function D(f)local x,q=pcall(fs.attributes,f)local
  123. w=x and q and(tostring(q.modified or q.modification)..":"..tostring(q.size))local r=m[f]if r and w and r.stamp==w then r.used=true;return r.img end local E,a=pcall(y.load,f)if E and a and a.w and a.w>
  124. 0 and a.h>0 then m[f]={stamp=w,img=a,used=true}return a end m[f]=nil end local function Q(q)local r={}if q.group then local w=P(q.path)if#w==0 then return false end local f,x={},false for F,E in ipairs(
  125. c)do local a=(E.number-1)%#w+1 if f[a]==nil then f[a]=D(w[a])or false end r[E]=f[a]x=x or f[a]~=false end if not x then return false end else local a=D(q.path)if not a then return false end for w,f in
  126. ipairs(c)do r[f]=a end end for f,a in ipairs(c)do a.current=r[a]l(a)end return true end local function R()for f,a in ipairs(c)do a.current=false l(a)end end local q,r={},nil local function x()local a=
  127. O()local E={}for w,f in pairs(m)do if f.used and fs.exists(w)then E[w]=f;f.used=false end end m=E if#a==0 then return nil,0 end local f if o=="name"then f=a[1]if r then for F,w in ipairs(a)do if w.key
  128. >r then f=w;break end end end else local F={}for G,w in ipairs(a)do F[w.path]=w end while#q>0 and not f do f=F[table.remove(q,1)]end if not f then for w=#a,2,-1 do local G=math.random(w)a[w],a[G]=a[G]
  129. ,a[w]end if#a>1 and a[1].key==r then a[1],a[#a]=a[#a],a[1]end for w=2,#a do q[#q+1]=a[w].path end f=a[1]end end r=f.key return f,#a end if#d==1 and not fs.isDir(shell.resolve(d[1]))then local a,w=y.
  130. load(shell.resolve(d[1]))if not a then printError(w);return end for E,f in ipairs(c)do f.current=a;l(f)end if e then u(nil)t()end return end if not e then print(("adview on %d display(s): %s"):format(
  131. #c,b.describe(c)))print("Ctrl+T stops.")end while true do local w=false local f,E=x()local a=0 while f and a<E do a=a+1 if Q(f)then w=true;break end if a<E then f=x()end end if not w then R()end if not
  132. u(n)then break end end if e then t()end print("Stopped.")
  133.  
Advertisement
Add Comment
Please, Sign In to add comment