sm64coopdx/autogen/convert_constants.py
MysterD 767809f56a Lua mod table and download
Mods are now loaded into a table
Clients now request a mod list from the server, then download each file one at a time before joining
Embedded constants.lua into the program
2022-01-22 23:59:49 -08:00

18 lines
582 B
Python

import os
in_filename = os.path.dirname(os.path.realpath(__file__)) + "/lua_constants/constants.lua"
out_filename = os.path.dirname(os.path.realpath(__file__)) + '/../src/pc/lua/smlua_constants_autogen.c'
built = "char gSmluaConstants[] = "
with open(in_filename) as fp:
lines = fp.readlines()
for line in lines:
if line.startswith('--'):
continue
if line.strip() == '':
continue
built += '"' + line.replace('\n', '').replace('\r', '') + '\\n"' + "\n"
built += ';'
with open(out_filename, 'w') as out:
out.write(built)