mediawiki-extensions-Scribunto/tests/engines/LuaCommon/CommonTests-lib.lua
Brad Jorsch df38a296bf Allow for dynamically-loaded PHP libraries
Scribunto currently supports libraries with PHP callbacks that are
loaded on startup, and pure-Lua libraries that may be loaded from the
module with require().

This change allows for libraries with PHP callbacks to also be loaded
with require().

Change-Id: Ibdc1f4ef51b1c8644c3d4c98d57755b5c06447a5
2014-10-03 09:27:23 -04:00

31 lines
475 B
Lua

local p = {}
local php
local options
function p.setupInterface( opts )
-- Boilerplate
p.setupInterface = nil
php = mw_interface
mw_interface = nil
options = opts
-- Loaded dynamically, don't mess with globals like 'mw' or
-- 'package.loaded'
end
function p.test()
return options.test, php.test()
end
function p.setVal( frame )
options.val = frame.args[1]
end
function p.getVal( frame )
return tostring( options.val )
end
p.foobar = { val = "nope" }
return p