18 lines
583 B
Python
18 lines
583 B
Python
import p8btools,argparse,io
|
|
|
|
parser = argparse.ArgumentParser(prog="python combine.py",description="Combines a lua file into a .p8 cart.")
|
|
parser.add_argument("result",help="The filename for the resulting cart.")
|
|
parser.add_argument("p8cart",help="A .p8 cart.")
|
|
parser.add_argument("luafile",help="The lua file to inject into the .p8 cart.")
|
|
args = parser.parse_args()
|
|
|
|
cart = p8btools.Cart(args.p8cart)
|
|
t = ""
|
|
lua = p8btools.LuaCode(args.luafile)
|
|
lua.parse()
|
|
t += lua.text
|
|
t += "\n"
|
|
cart.lua = t.rstrip()
|
|
with io.open(args.result,"w",encoding="utf-8") as f:
|
|
f.write(cart.fulltext)
|