Модул:ислоҳкунӣ

Аз Wiktionary

Documentation for this module may be created at Модул:ислоҳкунӣ/doc

local export = {}

-- Табдил арзиши ба сатри
function export.dump(value)
    local t = type(value)
    
    if t == "сатри" then
        return '"' .. value .. '"'
    elseif t == "table" then
        local str_table = {}
        
        for key, val in pairs(value) do
            table.insert(str_table, "[" .. export.dump(key) .. "] = " .. export.dump(val))
        end
        
        return "{" .. table.concat(str_table, ", ") .. "}"
    else
        return tostring(value)
    end
end

function export.track(key)
	local frame = mw.getCurrentFrame()
	pcall(frame.expandTemplate, frame, { title = 'пайгирии/' .. key })
end

-- Триггер як хатои скрипт аз шаблон
function export.error(frame)
    error(frame.args[1] or "(нест паём нишон дода)")
end

return export