forked from peyton2465/Dex
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.py
More file actions
28 lines (20 loc) · 650 Bytes
/
Copy pathbuild.py
File metadata and controls
28 lines (20 loc) · 650 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
embedStr = "local EmbeddedModules = {\n"
files = os.listdir("modules")
def readfile(path):
file = open(path,"r")
str = file.read()
file.close()
return str
def addModuleFile(path):
global embedStr
moduleName = os.path.splitext(os.path.basename(path))[0]
moduleSource = readfile(path)
embedStr = embedStr + '["' + moduleName + '"] = function()\n' + moduleSource + '\nend,\n'
for filename in files:
addModuleFile("modules/" + filename)
embedStr = embedStr + "}"
embedStr = embedStr + "\n" + readfile("main.lua")
file = open("out.lua","w")
file.write(embedStr)
file.close()