Advertisement
Eliont

prototype_collection.py

Sep 27th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. import os
  2.  
  3. prototypes = []
  4. for d, dirs, files in os.walk('prototypes'):
  5.     for f in files:
  6.             if f.endswith('lua'):
  7.                 path = os.path.join(d,f)
  8.                 prototypes.append(path)
  9.  
  10. with open('prototype_collection.lua','w') as luafile:        
  11.     for prototype in prototypes:
  12.         prototype = prototype.replace('.lua','').replace(os.sep,'.')
  13.         # print prototype
  14.         luafile.write('require("%s")\n'%prototype)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement