Getting Room Information from ext_events (prosody plugin)

Hello,
so I need for a Project get Information about participants of a conversation.

I was able to get json file (to work further with, because i am not a lua dev ;D) Here is my Code:
local function speaker_stats(room, speakerStats)
json = require “json”

    module:log("info", "LOG THIS JSON")
    module:log("info", json.encode(room))

    file = io.open("/tmp/speakerlogs.txt", "a")
    file:write(json.encode(speakerStats))
    file:close()

end

So I already am able to get the relevant speaker Information. But how can I include the room name in the json? if I try to log room -> its not working because its a function. What kind of function is it? should I pass the roomname earlier lets say in mod_speakerstats_component ?

A little hint on that would be awesome :slight_smile:

Okay guys I solved this! :slight_smile: If someone need similar, here is the solution:

local function speaker_stats(room, speakerStats)
  json = require "json"
  output = {}
  output[room.jid] = speakerStats
  module:log("info", json.encode(output))

  file = io.open("/tmp/speakerlogs.txt", "a")
  file:write(json.encode(output))
  file:close()

end

Oh yeah you have to install a json parsing lib first: https://github.com/rxi/json.lua