mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 23:30:41 +09:00
Add module export detection (#505)
Allow modules to include a module_exports.lua file in their root which will cause the file save/modules/module_name.lua to be generated pointing to the exports file.
This commit is contained in:
1 parent
ee105e0e28
commit
a4893751e9
3 files changed
+31
No files matched your search
@@ -47,6 +47,12 @@ export class SaveModule {
|
||||
if (entry.isFile()) {
|
||||
let savePath = SaveModule.moduleFilePath(relativePath, this.info.name);
|
||||
this.files.set(savePath, await fs.readFile(fsPath));
|
||||
if (relativePath == "module_exports.lua") {
|
||||
this.files.set(
|
||||
`modules/${this.info.name}.lua`,
|
||||
Buffer.from(`return require("modules/${this.info.name}/module_exports")`, "utf-8")
|
||||
);
|
||||
}
|
||||
|
||||
} else if (entry.isDirectory()) {
|
||||
dirs.push([fsPath, relativePath]);
|
||||
|
||||
Reference in new issue
Block a user