error checking to prevent lua crash
added tile memory, and press 3 to generate texture from tile memory