[0.17.7] Requiring lua scripts from other mods: incorrect path to file
Posted: Thu Mar 07, 2019 12:20 pm
I am trying to require a script file from another mod in my mod during the data stage. The target file sits in a subfolder of this mod and itself requires further files. While the original mod loads fine, requiring the mod's script file from my mod messes up all further requires inside that file.
Minimal working example (ready-to-use version attached):
mod_A/data.lua:
mod_B/subfolder/some_script:
helper_script.lua also sits inside mod_B/subfolder.
This situation leads to the following error (complete log attached):
Failed to load mods: __mod_A__/data.lua:1: __mod_B__/subfolder/some_script.lua:1: module subfolder.helper_script not found;
no such file __mod_B__/subfolder/subfolder/helper_script.lua
no such file __mod_A__/subfolder/helper_script.lua
no such file D:/Programme/Steam/steamapps/common/Factorio/data/core/lualib/subfolder/helper_script.lua
Minimal working example (ready-to-use version attached):
mod_A/data.lua:
Code: Select all
require("__mod_B__.subfolder.some_script")
Code: Select all
require("subfolder.helper_script")
This situation leads to the following error (complete log attached):
Failed to load mods: __mod_A__/data.lua:1: __mod_B__/subfolder/some_script.lua:1: module subfolder.helper_script not found;
no such file __mod_B__/subfolder/subfolder/helper_script.lua
no such file __mod_A__/subfolder/helper_script.lua
no such file D:/Programme/Steam/steamapps/common/Factorio/data/core/lualib/subfolder/helper_script.lua