Running StepMania with the command line argument of --ExportLuaInformation while the current 5.1's default theme (Lambda) was selected added some seemingly stray Lua variables to the Constants table in ./Docs/Luadoc/Lua.xml.
I spotted them here: http://dguzek.github.io/Lua-For-SM5/LuaAPI#Constants
I'm assuming num, bPreference, and bCategory don't need global scope, so I added the local keyword where appropriate.
I'd like to thank everyone who made this possible;, including but not
limited to Riakodoadm, MrThatKid, kyzentun, Luizsan, JoseVarelaP,
everyone else who provided feedback and bug reports.