Make a nice helper function that applies patches
Replace apply_patch with lua calls.