AM ONLY ASKING BECAUSE DOCS ARE SCARCE, AND THE LUA BRIDGE CODE ISN'T CLICKING ENTIRELY IN MY HEAD, YET...

Are Lua scripts able to emit input events? or do things like change media currently in drives?

I am currently having to write a whole lot of custom code in MAME to do this programmatically over a TCP/IP interface, and I would love to know if I could do it in Lua instead, and avoid having to butcher the %(@#!# out of the main codebase?

Yes, ioport_field:set_value(value), see the example at https://gist.github.com/cracyc/02cbcac7b869329e7d8b280ef6c77fa5. Yes, machine:images[]:load(path), this is untested, let me know if it doesn't work. emu.file:open("socket.127.0.0.1:1234") can open sockets too just like the bitbanger. The overall layout of the bridge, for better or worse, is basically the same as mame overall.

The only real difference is that plugins are run at the program start and are persistent while autoboot_scripts are run every time the emulation is reset. The MarI/O port I linked to is an autoboot_script because it is only needed while the game is running but sounds like for what you want a plugin might be more appropriate.