Reference by global in statistics_exporter

Store export function in a global table in the lua module for statistics
exporter in order to avoid a remote.call.
This commit is contained in:
Hornwitser committed 2020-01-04 17:34:16 +01:00
1 parent 0e9cd35c30
commit 6cf16cc09e
4 files changed
+6 -11

No files matched your search

@@ -5,7 +5,8 @@ local statistics = {
"entity_build_count_statistics",
}
local function export()
statistics_exporter = {}
function statistics_exporter.export()
local stats = {
game_tick = game.tick,
player_count = #game.connected_players,
@@ -31,9 +32,3 @@ local function export()
rcon.print(game.table_to_json(stats))
end
return {
add_remote_interface = function()
remote.add_interface("statistics_exporter", { export = export })
end
}