mediawiki-extensions-Parser.../mw.ext.ParserFunctions.lua
Jackmcbarn f7bd89e435 Allow calling #expr from Lua without the parser
Add mw.ext.ParserFunctions.expr, allowing #expr to be used without needing
to use frame:callParserFunction.

Change-Id: I64c78fafad7da503b141efb36da64c3e3d8501a5
2014-05-05 17:58:40 +00:00

23 lines
478 B
Lua

local ParserFunctions = {}
local php
function ParserFunctions.expr( expression )
return php.expr( expression )
end
function ParserFunctions.setupInterface( options )
-- Boilerplate
ParserFunctions.setupInterface = nil
php = mw_interface
mw_interface = nil
-- Register this library in the "mw" global
mw = mw or {}
mw.ext = mw.ext or {}
mw.ext.ParserFunctions = ParserFunctions
package.loaded['mw.ext.ParserFunctions'] = ParserFunctions
end
return ParserFunctions