#GitHub - wauterboi/require: Monkey-patch...

1 messages · Page 1 of 1 (latest)

rustic dagger
#

What changed

Instead of saving loaders to package.preload after they're built, this doesn't happen anymore. The reasons for this change are that isn't Lua 5.1 standard and the function that builds the loader for custom files returns the result of CompileFile. Since, at that point, it has read the file, it wouldn't read it again unless the cache was manually cleared, which is annoying, redundant, and doesn't really benefit anyone.

Reloading still has to be done manually by clearing the package.loaded value, but it's pretty easy to roll your own manual refresh system on your own using hooks and the lua_refresh_file command. Where one would produce an include guard, I use a personal cleanup hook and just call my gamemode's sh_init.lua again.

Should I use this addon

I don't think anyone really cares about global pollution, or traditional Lua, so unless those interest you... probably not. With that said, if you would like an alternative to include that caches return values and executes within a minimal environment, this might be interesting. All of this is experimental at the end of the day.

outer dock
#

hell yeah

tame latch
#

can I package.loaders[3]

rustic dagger