Module Inserter


Mass insert modules into machines with construction bots

Utilities
2 months ago
0.13 - 1.1
140K

b __ModuleInserter__/gui.lua:246: attempt to index local 'pdata' (a nil value)

4 years ago
(updated 4 years ago)

Conflict with another mod that player.force.technologies['construction-robotics'].researched=true while running event level::on_player_created (ID 24).

Logs:

546.839 Error MainLoop.cpp:1207: Exception at tick 0: The scenario level caused a non-recoverable error.
Please report this error to the scenario author.

Error while running event level::on_player_created (ID 24)
The mod Module Inserter (5.0.7) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event ModuleInserter::on_research_finished (ID 18)
__ModuleInserter__/gui.lua:246: attempt to index local 'pdata' (a nil value)
stack traceback:
    __ModuleInserter__/gui.lua:246: in function 'register_action'
    __ModuleInserter__/gui.lua:363: in function 'init'
    __ModuleInserter__/control.lua:723: in function <__ModuleInserter__/control.lua:720>
stack traceback:
    ...oaming/Factorio/temp/currently-playing/playerBonuses.lua:185: in function 'handler'
    __core__/lualib/event_handler.lua:47: in function <__core__/lualib/event_handler.lua:45>
stack traceback:
    [C]: in function '__newindex'
    ...oaming/Factorio/temp/currently-playing/playerBonuses.lua:185: in function 'handler'
    __core__/lualib/event_handler.lua:47: in function <__core__/lualib/event_handler.lua:45>

It looks like you might need to init gui.lua#L299 or do some type of null check gui.lua#L246.

Could be that technology check for construction-robotics happens before there is a change to setup _pdata?

I've tried making your mod a optional dependency for my mod, so your events (like on_player_created) trigger before mine, but that does not seem to work.

Thank you for the awesome mod ๐Ÿ˜€
-Kizrak

4 years ago
(updated 4 years ago)

Also saw control.lua#L723 which happens each time a research is completed, but _pdata may not have been setup yet? ๐Ÿ‘

4 years ago

Thanks for the report, should be fixed in the latest update.
The event order with regards to scenarios is annoying i think, if a scenario triggers an event during on_player_created mods react to that event before they had the chance to run their on_player_created handler (i think). Second time today i fixed an error because of a scenario doing that xD

4 years ago

Hello Choumiko,

I've updated to 5.0.8 (released about 4 days ago). I am getting a slightly different error, but mostly the same. Here is the log message:

  55.231 Error MainLoop.cpp:1207: Exception at tick 0: The scenario level caused a non-recoverable error.
Please report this error to the scenario author.

Error while running event level::on_player_created (ID 24)
The mod Module Inserter (5.0.8) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event ModuleInserter::on_research_finished (ID 18)
__ModuleInserter__/gui.lua:246: attempt to index local 'pdata' (a nil value)
stack traceback:
    __ModuleInserter__/gui.lua:246: in function 'register_action'
    __ModuleInserter__/gui.lua:363: in function 'init'
    __ModuleInserter__/control.lua:735: in function <__ModuleInserter__/control.lua:729>
stack traceback:
    ...oaming/Factorio/temp/currently-playing/playerBonuses.lua:185: in function 'handler'
    __core__/lualib/event_handler.lua:47: in function <__core__/lualib/event_handler.lua:45>
stack traceback:
    [C]: in function '__newindex'
    ...oaming/Factorio/temp/currently-playing/playerBonuses.lua:185: in function 'handler'
    __core__/lualib/event_handler.lua:47: in function <__core__/lualib/event_handler.lua:45>

Please let me know if there is anything else I can do to assist. ๐Ÿงก

Thanks,
-Kizrak

4 years ago

Thank you!

This seems to be working for me now ๐Ÿš€

New response