Add function blacklist

This commit is contained in:
Fierelier 2023-05-14 22:20:15 +02:00
parent c6244ae65f
commit 88b6772a14

View File

@ -16,6 +16,10 @@ typesOut = {
"char *": "lua_pushstring" "char *": "lua_pushstring"
} }
functionBlacklist = [
"engine_malloc"
]
functions = toml.loads(open("modules/engine/FUNCTIONS.toml").read()) functions = toml.loads(open("modules/engine/FUNCTIONS.toml").read())
ofile = open("modules/engine/addon/lua.c","w") ofile = open("modules/engine/addon/lua.c","w")
@ -28,6 +32,7 @@ lua_State * engine_lua_state;
''') ''')
for func in functions: for func in functions:
if func in functionBlacklist: continue
invarCount = 1 invarCount = 1
funcnew = "engine_luaf_" +func.replace("engine_","",1) funcnew = "engine_luaf_" +func.replace("engine_","",1)
ofile.write('int ' +funcnew+ '(lua_State *L) {\n') ofile.write('int ' +funcnew+ '(lua_State *L) {\n')
@ -70,6 +75,7 @@ void engine_luaInit() {
''') ''')
for func in functions: for func in functions:
if func in functionBlacklist: continue
funcnew = "engine_luaf_" +func.replace("engine_","",1) funcnew = "engine_luaf_" +func.replace("engine_","",1)
ofile.write('\tlua_pushcfunction(engine_lua_state,' +funcnew+ ');\n') ofile.write('\tlua_pushcfunction(engine_lua_state,' +funcnew+ ');\n')
ofile.write('\tlua_setglobal (engine_lua_state,"' +func+ '");\n') ofile.write('\tlua_setglobal (engine_lua_state,"' +func+ '");\n')