there are a number of things going wrong with your example. the first being as
mentioned by nrk that you have extra brackets around your seq[int]. The code
below should fix that issue as well as the others assuming I am partially
interpreting what you are trying to do correctly.
import random
import tables
type
Box = object
x, y, w, h: int
var layer = initTable[string, seq[Box]]()
func toLayer(layer: var Table[string, seq[Box]], b:Box)=
var k = ""
for j in b.x..<b.w:
k = k & $j & ","
for i in b.y..<b.h:
k = k & $i
layer.mgetOrPut(k, @[]).add b
for n in 0..<100:
toLayer(layer, Box(
x: rand(100),
y: rand(100),
w: rand(100),
h: rand(100)
))
Run