Page MenuHomePhabricator

Add a method of determining which Module was invoked from within Lua
Closed, ResolvedPublic

Description

I'd like to request that a method be added to determine from within Lua what Module name was present in the invoke instruction, i.e.

{{ #invoke: MyModule | test }}

I'd like the called function to be able to determine that MyModule is the origin of the call.

My use case for this is being able to differentiate behavior for:

{{ #invoke: MyModule | test }} and
{{ #invoke: MyModule/sandbox | test }}

Where the sandbox is likely to contain near identical code to the main Module but you might want it to do something different (e.g. add extra diagnostic output, include the /sandbox version other modules rather than the main version, etc.)

The most natural way that I can see to do this is to have the Lua function look for "/sandbox" in the name of the invoked Module, but there doesn't seem to be any way at present for Lua to know what Module was being invoked.


Version: unspecified
Severity: enhancement

Details

Reference
bz47089

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:27 AM
bzimport added a project: Scribunto.
bzimport set Reference to bz47089.
bzimport added a subscriber: Unknown Object (MLST).

Change 99797 had a related patch set uploaded by Anomie:
Expose PPFrame::getTitle to Lua

https://gerrit.wikimedia.org/r/99797

Change 99797 merged by jenkins-bot:
Expose PPFrame::getTitle to Lua

https://gerrit.wikimedia.org/r/99797

Change has been merged. It should be deployed to WMF wikis with 1.23wmf7, see https://www.mediawiki.org/wiki/MediaWiki_1.23/Roadmap for the schedule.