In Factorio, our require paths can take the form of require("__modname__/somefile.lua") or require("__modname__.somefile"), for loading files from another mod. For most mod devs, stripping the __ and .lua and looking for this in the ordinary fashion (in workspace or library paths, one of which will include the /mods tree) should be sufficient to make this actually resolve.
I have tried several variations of moduleMap rules
"moduleMap": [
{
"pattern": "^__(.*)__(.*)$",
"replace": "$1$2"
},
{
"pattern": "^(.*)\\.lua$",
"replace": "$1"
}
]
"moduleMap": [
{
"pattern": "__",
"replace": ""
},
]
but nothing seems able to make these able to resolve
emmylua understands these correctly, but they would not work in Factorio:
local sigstr = require("signalstrings/signalstrings")
local sigstr = require("signalstrings.signalstrings")
but not any of these, which are what would actually work in Factorio:
local sigstr = require("__signalstrings__/signalstrings.lua")
local sigstr = require("__signalstrings__.signalstrings")
local sigstr = require("__signalstrings__/signalstrings")
In Factorio, our require paths can take the form of
require("__modname__/somefile.lua")orrequire("__modname__.somefile"), for loading files from another mod. For most mod devs, stripping the__and.luaand looking for this in the ordinary fashion (in workspace or library paths, one of which will include the /mods tree) should be sufficient to make this actually resolve.I have tried several variations of moduleMap rules
but nothing seems able to make these able to resolve
emmylua understands these correctly, but they would not work in Factorio:
local sigstr = require("signalstrings/signalstrings")local sigstr = require("signalstrings.signalstrings")but not any of these, which are what would actually work in Factorio:
local sigstr = require("__signalstrings__/signalstrings.lua")local sigstr = require("__signalstrings__.signalstrings")local sigstr = require("__signalstrings__/signalstrings")