>>521
if (not hoge) then
hoge = {}
end
hoge[obj.layer] = "hogehoge"

こうすればhoge[obj.layer]はレイヤーごとにhoge[1],hoge[2]……となるから
違うレイヤーで変数を上書きしてしまうのを回避できると思う