Файл:Imbox deletion.png Внимание! Начат процесс обновления Wiki до версии игры 10.x. Если у Вас есть желание принять участие, то Вы можете найти больше информации в нашем ECO Contribution Wiki Discord.

Модуль:Ecopedia: различия между версиями

Материал из Eco - Русская Wiki
Перейти к:навигация, поиск
[непроверенная версия][непроверенная версия]
Нет описания правки
мНет описания правки
 
(не показано 9 промежуточных версий этого же участника)
Строка 19: Строка 19:
     local args = norm()
     local args = norm()
      
      
if args.list == nil or args.list == '' then
if args.text == nil or args.text == '' then
         return '\'list\' must be specified.'
         return '\'text\' must be specified.'
     end
     end
    local list = args.list
    -- load lists
    local EcopediaData = require( "Module:EcopediaData" )
local Ecopedia = ''


    local index = args.text


if index == '' then
local a = {}
return '\'text\' must be specified.'
Ecopedia = Ecopedia .. '=== Ecopedia ===\n'    
    end
for k,v in pairs(EcopediaData.ecopedia) do       
 
            if EcopediaData.ecopedia[k].root == true then
        Data = require( "Module:EcopediaData" )
              table.insert(a,k)
        String = Data.text[index]
            end
 
if String == {} then return Data.. ' could not be found in Module:EcopediaData.' end
 
return String


        table.sort(a)
        for i,n in ipairs(a) do
            Ecopedia = Ecopedia .. '* [[' .. n .. ']]\n'               
        end
end
return Ecopedia
end
end
return p
return p

Текущая версия от 08:57, 3 октября 2020

Для документации этого модуля может быть создана страница Модуль:Ecopedia/doc

local p = {}

function norm()
    local origArgs = mw.getCurrentFrame():getParent().args
    local args = {}
    
    for k, v in pairs( origArgs ) do
        v = mw.text.trim( tostring( v ) )
        if v ~= '' then
            args[k] = v
        end
    end
    
    return args
end

function p.main()

    local args = norm()
    
	if args.text == nil or args.text == '' then
        return '\'text\' must be specified.'
    end

    local index = args.text

	if index == '' then
		return '\'text\' must be specified.'
    end

        Data = require( "Module:EcopediaData" )
        String = Data.text[index]

if String == {} then return Data.. ' could not be found in Module:EcopediaData.' end

return String

end
return p