Update maze.lua

• Made variables local
• Added position tracking variables
• Made the array initialization into a function to be called first by main()
• Other minor capitalization changes