How to properly indent code like this

I have code like this:

let questions = shuffle([
    "What is first letter in Alphabet",
    "What is second letter in Alphabet",
    "What is third letter in Alphabet",
    "What is fourth letter in Alphabet"
    ].map(lambda(question, i)
            return [question, i]
        end)
).filter(lambda(arr)
        return arr[0] == 1
    end)

How to properly indent code like this, it seems that simple Ruby and Lua mode doesn’t support something like this. JS mode supports code like this but it’s a little bit complicated.

let questions = shuffle([
  "What is first letter in Alphabet",
  "What is second letter in Alphabet",
  "What is third letter in Alphabet",
  "What is fourth letter in Alphabet"
].map(function(question, i) {
  return [question, i]
})).filter(function(arr) {
  return arr[0] == 1
})

Do you have any advice on how to fix the mode that is based on Lua and Ruby to handle code like this?

I’m not sure if this is the right Lua code, but this doesn’t indent properly either, that’s probably why my mode based on Lua doesn’t work as expected:

shuffle([
  "foo",
  "bar"
  ])

adding more functions make it double indentation and looks worse:

sort(shuffle([
    "foo",
    "bar"
    ]))

Here is a link to my mode: gaiman/codemirror.js at master · jcubic/gaiman · GitHub any advice would be great.