Last modified: 2014-07-08 13:09:09 UTC
Create the following as Module:Foo: local p = {} local f = mw.getCurrentFrame() function p.main(frame) return 'The title of the current frame is ' .. f:getTitle() end return p When {{#invoke:Foo|main}} is used in a page, a script error will be generated because f is nil. Note the bug is not present in the console, where running =p.main() will produce the expected result. Also, if the following is created as Module:Bar: local p = {} local d = os.date() function p.main(frame) return 'The date when the module was ran was ' .. d end return p {{#invoke:Bar|main}} will return a script error because the TTL logic in os.date() assumes that frames are available at this point, when in fact they are not. Again, this only malfunctions when called from wikitext; =p.main() works properly from the console.
Change 144478 had a related patch set uploaded by Anomie: Improve mw.getCurrentFrame handling https://gerrit.wikimedia.org/r/144478
Change 144478 merged by jenkins-bot: Improve mw.getCurrentFrame handling https://gerrit.wikimedia.org/r/144478
Change 144511 had a related patch set uploaded by Jackmcbarn: Improve mw.getCurrentFrame handling https://gerrit.wikimedia.org/r/144511
Change 144511 merged by jenkins-bot: Improve mw.getCurrentFrame handling https://gerrit.wikimedia.org/r/144511