#NEWLINE# def compileLuaDirectory( resourceDirectory = os . getcwd ( ) ) : #NEWLINE# #INDENT# userInput = raw_input ( ( '* Would you like to back up %s? All current backups will be lost! [y/n]\n' % resourceDirectory ) ) #NEWLINE# if ( userInput == 'y' ) : #NEWLINE# #INDENT# backupSuccessfull = backupDirectory ( resourceDirectory ) #NEWLINE# if ( not backupSuccessfull ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# print ( ( '* Compiling scripts in %s...' % resourceDirectory ) ) #NEWLINE# for ( currentDirectory , subDirectories , filePaths ) in os . walk ( resourceDirectory ) : #NEWLINE# #INDENT# for filePath in filePaths : #NEWLINE# #INDENT# if ( ( '.lua' in filePath ) and ( not ( 'backup' in currentDirectory ) ) ) : #NEWLINE# #INDENT# scriptPath = os . path . join ( currentDirectory , filePath ) #NEWLINE# print ( ( '* Compiling script %s...' % scriptPath ) ) #NEWLINE# try : #NEWLINE# #INDENT# os . system ( ( 'luac -o %s %s' % ( scriptPath , scriptPath ) ) ) #NEWLINE# #UNINDENT# except Exception as errorMessage : #NEWLINE# #INDENT# print ( ( 'ERROR: Failed to compile script %s! Reason: %s\n' % ( scriptPath , errorMessage ) ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# print ( ( '* All Lua scripts in %s have been compiled successfully!\n' % resourceDirectory ) ) #NEWLINE# return True