support array-like indexing for variables