use warnings;
use strict;
use File::Find;
Main();
sub Main {
my @aBasedir = ();
if(scalar(@ARGV) < 1){
print "Please enter Dirlist\n";
my $sInput = <>; chop($sInput);
@aBasedir = split(' ',$sInput);
}
else { @aBasedir = @ARGV; }
print "Dirlist given = @aBasedir \n";
find(\&process_file, @aBasedir);
print "End buildin lub\n";
}
sub process_file { my $sCurfile = $File::Find::name;
return unless(-f $sCurfile);
return unless ($sCurfile =~ /.lua/ );
CompileFile($sCurfile);
}
sub CompileFile { my ($sFile) = @_;
my $sOutputFilane = $sFile;
$sOutputFilane =~ s/.lua/.lub/;
print "CC -o $sOutputFilane $sFile\n";
system("luac -o $sOutputFilane $sFile");
}