lua/directory searcher

Posts 1–4 of 4 · Page 1 of 1
lua/directory searcher
So i am trying to use "Blue Kirbys" directory scanner script but I dont know how to use it at all, i go onto a darkrp server and run the script using a bypasser but nothing happens when i do it. What do i do?

Code:
local function Scan( returnfiles, path )
	local files, dirs = file.Find( (returnfiles and ((path and path.."/" or "").."*.lua") or (path and path or "").."*"), "lsv", "namedesc" );
	
	return (returnfiles and files or dirs);
end

local function ReadFile( filename, mode ) --Custom file.Read function since I overwrite mine. I'll leave this in here so you understand how it works.
	local f = file.Open( filename, "r", mode );
	
	if (!f) then return end
	
	local contents = f:Read( f:Size() );
	f:Close()
	
	return contents;
end

local dirs = Scan( );
local i = 0;
local currentdir = dirs[1];

repeat
	i=i+1
	currentdir = dirs[i] or false;
	
	if (currentdir) then
	
		local scanneddir = Scan( false, currentdir.."/" ) or {};
		
		for k, v in pairs( scanneddir ) do
			scanneddir[k] = tostring(dirs[i]).."/"..v
		end
		
		table.Add( dirs, scanneddir );
	end
until currentdir == false or i == 1000 --Have a safe at 1000 so you don't crash

for _, file in pairs( Scan( true ) ) do --Go through normal lua folder
	print( ReadFile( file, "lsv" ) or "" );
end

for _, dir in pairs( dirs ) do --Go through all the directories we just made
	local files = Scan( true, dir ); --Get the table of all the files
	
	for _, file in pairs( files ) do --Go through all the files
		print( ReadFile( dir.."/"..file, "lsv" ) ); --Print the contents of the file.
	end
end
reply to the op, don't make a new one.
already did nobody responded
And for good reason too.
Posts 1–4 of 4 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us