Bitcoin scripting don't support feature you mentioned since it's not turing complete.
...
Can you explain, what this means? Why is Turing completeness required to access data of previous transaction?
As achow pointed out, it is a limitation of the scripting language to access the internal data structures. And the Turing completeness is explicitly removed from bitcoin scripting, to also avoid security issues.