NES emulator hacker Xkeeper has been working on a Lua script that allows you to manipulate Super Mario Bros. game objects right in the middle of game play:

FCEUX is a NES emulator. It has Lua scripting support, and in the latest versions, a feature that allows you to grab input from the mouse and keyboard, outside of the “game input”.

The script allows you to see the byte values of tiles by mousing over them and you can grab enemies (including things like lifts or projectiles) and move them around with your mouse. This particular Lua script hasn’t been released on the FCEUX site yet, but it should be soon and there are several other Lua demos available in the luapack archive.

The Lua add-on to FCEUX allows you to cobble in your own code that will execute before each frame draw in the emulator, giving you an opportunity to manipulate things while the game is running. I’ve never coded in Lua, but the demo source code is easy to grok, and you may get some fun ideas for another game hack.