Last modified: 2014-05-27 00:13:05 UTC
Create Module:Foo with the following code: local p, mt = {}, {} function mt.__index(table, key) return function(frame) return 'You called the ' .. key .. ' function' end end setmetatable(p, mt) return p From the console, "=p.bar()" correctly produces "You called the bar function". However, from wikitext, "{{#invoke:Foo|bar}}" instead produces "Script error: The function "bar" does not exist."
I don't currently have LuaSandbox set up, but while trying to fix this, I noticed that in LuaStandalone, passing an object from Lua to PHP and back causes its metatable to be lost.
Change 127458 had a related patch set uploaded by Jackmcbarn: Keep modules' export tables inside Lua https://gerrit.wikimedia.org/r/127458
Change 127458 merged by jenkins-bot: Keep modules' export tables inside Lua https://gerrit.wikimedia.org/r/127458
This will be live on all WMF wikis starting June 5th.