mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-27 16:47:13 +09:00
Refactor statisticsExporter lua code
Rewrite lua part of statisticsExporter to to use game.table_to_json and the save patching based module system.
This commit is contained in:
1 parent
1a035e849e
commit
1595555154
3 files changed
+34
-29
No files matched your search
@@ -1,9 +1,5 @@
|
||||
const needle = require("needle");
|
||||
const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
|
||||
const clusterTools = require("lib/clusterTools")();
|
||||
const pluginConfig = require("./config");
|
||||
|
||||
module.exports = class remoteCommands {
|
||||
constructor(mergedConfig, messageInterface, extras){
|
||||
@@ -36,11 +32,9 @@ module.exports = class remoteCommands {
|
||||
});
|
||||
}, 15000);
|
||||
}
|
||||
async getStats(){
|
||||
let command = fs.readFileSync(path.join(__dirname, "Lua/exportStatistics.lua"), "utf8")//clusterTools.getLua(path.join(__dirname, "Lua/exportStatistics.lua"), false);
|
||||
let string = await this.messageInterface(`/silent-command ${command}`);
|
||||
var data;
|
||||
eval(`data = ${string}`);
|
||||
return data;
|
||||
|
||||
async getStats() {
|
||||
let string = await this.messageInterface('/sc remote.call("statisticsExporter", "export")');
|
||||
return JSON.parse(string);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user