0ptera / Loader-Redux

Factorio Mod adding Loaders to the game.
MIT License
11 stars 11 forks source link

Can't index `supported_loaders` when calling `add_loader` interface during `on_load` #54

Open kirazy opened 2 years ago

kirazy commented 2 years ago

Error message or bug description

Error while running event vanilla-loaders-hd::on_load()
Error when running interface function loader-redux.add_loader: LoaderRedux/control.lua:26: attempt to index field 'supported_loaders' (a nil value)
stack traceback:
LoaderRedux/control.lua:26: in function <LoaderRedux/control.lua:24>
stack traceback:
[C]: in function 'call'
vanilla-loaders-hd/control.lua:209: in function 'do_init'
vanilla-loaders-hd/control.lua:231: in function <vanilla-loaders-hd/control.lua:230>

Relevant lines from vanilla-loaders-hd: https://github.com/kirazy/vanilla-loaders-hd/blob/master/control.lua#L206-L232

To Reproduce https://mods.factorio.com/mod/vanilla-loaders-hd/discussion/623f6acfb620f1c4a1edc98e

I've asked him to upload a save. I'm expecting this is related to changes for #53, commit 7ada2b760997abd5ecc9e401d32ead0b31a19390. I can't personally reproduce this issue and a quick examination of control.lua doesn't expose anything obvious to me.

Loader Redux version 1.7.2

0ptera commented 2 years ago

Loader tables where made global to be MP save. With this using add_loader and remove_loader in on_load is no longer possible. Please use on_init and on_configuration_changed instead.