Question: Compute indices of variables in Maple

I want to define a function f in Maple such that $f(x[1,2]^{-1/3})=\{1,2\}, f(x[1,2])=\{1,2\}, f(x[1])=\{1\}, f(x[1]^{1/3}) =\{1\}$, f(x)=empty set. How could I do this in Maple? Thank you very much.

Please Wait...