Currently there is no proper way in Lua to get such basic things about the current page name. To fix this, I propose to provide a MediaWiki API accessible from the Lua scripts: https://www.mediawiki.org/wiki/Extension:Scribunto/API_specification Any feedback appreciated.
— Victor.