19 lines
607 B
Python
19 lines
607 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from lupa import LuaRuntime
|
|
|
|
|
|
project_root = Path(__file__).resolve().parents[2]
|
|
runner = Path(__file__).with_name("lua") / "run.lua"
|
|
runtime = LuaRuntime(unpack_returned_tuples=True)
|
|
runtime.globals().PROJECT_ROOT = project_root.as_posix()
|
|
compile_file = runtime.eval(
|
|
"function(path) local chunk, message = loadfile(path); "
|
|
"if not chunk then error(message) end end"
|
|
)
|
|
for lua_file in sorted((project_root / "42.20/media/lua").rglob("*.lua")):
|
|
compile_file(lua_file.as_posix())
|
|
runtime.execute(runner.read_text(encoding="utf-8"))
|