Модуль:Песочница/Pok: различия между версиями

Нет описания правки
Нет описания правки
Строка 5: Строка 5:
local function get_page_var()
local function get_page_var()
local frame = mw.getCurrentFrame()
local frame = mw.getCurrentFrame()
if mw.ext and mw.ext.VariablesLua and mw.ext.VariablesLua.var then
if mw.ext and mw.ext.VariablesLua and type(mw.ext.VariablesLua.var) == "function" then
local v = mw.ext.VariablesLua.var("GetFieldPath")
local v = mw.ext.VariablesLua.var("GetFieldPath")
if v and v ~= "" then return v end
if v and v ~= "" then return v end
end
end
local v = frame:callParserFunction{ name = '#var', args = { "GetFieldPath" } }
local ok, v = pcall(function() return frame:callParserFunction{ name = "var", args = { "GetFieldPath" } } end)
if v and v ~= "" then return v end
if ok and v and v ~= "" then return v end
return nil
return nil
end
end
Строка 40: Строка 40:


p.get_module_name = get_module_name
p.get_module_name = get_module_name
p._debug_get_cached = function() return CURRENT_PROJECT end
p._debug_get_cached = function() return CURRENT_PROJECT, get_page_var() end


local function load_cached_data(moduleName)
local function load_cached_data(moduleName)