User blog comment:Catinthedark/Infobox level: killing the massive switches/@comment-3225604-20150705085205/@comment-4189499-20150706105312

Hehehe. Yes, Wikia can do that to you!

The reason it's called without parameters in infobox levels is because it's meant to work so that, if not calling any page, it will return the difficulty of the current page. That was the main reason the initial template was created a few years back with the horrible #switch statement based on page name.

I think this need is the main reason the code looks so nasty. It uses that logic statement to check the existence of different parameters and then return the applicable result. If it would help, an #if statement to check for the presence of the first parameter in the template (as opposed to the module) can be used and return if it doesn't, but by the same token, I think it would be preferable to not mix Lua and wikitext where possible for the sake of tracking what does what later. Unless you can figure out a cleaner method of having the module check if the first parameter is in use and then decide which page's difficulty to return, I think we're gonna just have to leave it as it is. We need to prioritise making the usage of the template easiest for the casual editor over making the code the cleanest and nicest on the back-end, which most users don't see.