Модуль:RandomMembers: відмінності між версіями
| Admin (обговорення | внесок) Немає опису редагування | Admin (обговорення | внесок)  Немає опису редагування | ||
| (Не показані 4 проміжні версії цього користувача) | |||
| Рядок 1: | Рядок 1: | ||
| -- This module will handle the shuffling and display of random players. | |||
| local p = {}  -- Define a table to hold your module's functions | |||
| function p.showRandomPlayers(frame) | |||
|     math.randomseed(os.time())  -- Seed the random number generator | |||
|     -- List of players | |||
|     local players = { | |||
|         "Індиго", "Адамант", "Алоха", "Аріель", "Берлін", "Бетмен", "Браун", "ВВ", | |||
|         "Дантес", "Демон", "Джордж", "Доктор Хаус", "Доктор Ямато", "Емесай", "ЕХС", "Кексік", | |||
|         "Керміт", "Клайд", "Клей", "Комар", "Лемур", "Містер Тен", "Малена", "Мальвінка",  | |||
|         "Маска", "Мері", "Механік", "Ніколетта", "Оттерія", "Расм", "Сімон", "Справа",  | |||
|         "Тайєр", "Тян", "Фавер", "Фаза", "Фейт", "Хантер", "Хоррорчік", "Шостік" | |||
|     } | |||
|     -- Shuffle players | |||
|     for i = #players, 2, -1 do | |||
|         local j = math.random(i) | |||
|         players[i], players[j] = players[j], players[i] | |||
|     end | |||
|     -- Collect the first four players | |||
|      local output = {} |      local output = {} | ||
|      for i = 1, 4 do | |||
|          table.insert(output, string.format('<p>[[%s|%s]]</p>', players[i], players[i])) | |||
|      end |      end | ||
| Рядок 27: | Рядок 30: | ||
| end | end | ||
| return p | return p  -- Return the table to make its functions accessible to other modules | ||
Поточна версія на 21:15, 22 квітня 2024
Документацію для цього модуля можна створити у Модуль:RandomMembers/документація
-- This module will handle the shuffling and display of random players.
local p = {}  -- Define a table to hold your module's functions
function p.showRandomPlayers(frame)
    math.randomseed(os.time())  -- Seed the random number generator
    -- List of players
    local players = {
        "Індиго", "Адамант", "Алоха", "Аріель", "Берлін", "Бетмен", "Браун", "ВВ",
        "Дантес", "Демон", "Джордж", "Доктор Хаус", "Доктор Ямато", "Емесай", "ЕХС", "Кексік",
        "Керміт", "Клайд", "Клей", "Комар", "Лемур", "Містер Тен", "Малена", "Мальвінка", 
        "Маска", "Мері", "Механік", "Ніколетта", "Оттерія", "Расм", "Сімон", "Справа", 
        "Тайєр", "Тян", "Фавер", "Фаза", "Фейт", "Хантер", "Хоррорчік", "Шостік"
    }
    
    -- Shuffle players
    for i = #players, 2, -1 do
        local j = math.random(i)
        players[i], players[j] = players[j], players[i]
    end
    -- Collect the first four players
    local output = {}
    for i = 1, 4 do
        table.insert(output, string.format('<p>[[%s|%s]]</p>', players[i], players[i]))
    end
    return table.concat(output, "\n")
end
return p  -- Return the table to make its functions accessible to other modules