ethangreen-dev / lovely-injector

A runtime lua injector for games built with LÖVE
MIT License
79 stars 11 forks source link

Load modules lazily through package.preload #74

Closed flakywanderer closed 2 months ago

flakywanderer commented 2 months ago

Change the module loading system to use package.preload for loading packages, which uses Lua's intended mechanisms for loading modules into Lua from C, rather than through package.loaded which is Lua's module cache. This change also loads modules lazily. As an escape hatch for potential unintentional dependency on lovely's previous eager module loading order, module patches have an additional option load_now, which if enabled loads them eagerly rather than lazily.

flakywanderer commented 2 months ago

Okay, I adjusted the branch to account for changes you merged recently.