Модуль:ChatCommandslist
Материал из Eco - Русская Wiki
Для документации этого модуля может быть создана страница Модуль:ChatCommandslist/doc
local p = {}
function p.main()
local wiki = ''
-- import the required modules
local commandsData = require( "Module:CommandData" )
local commands = commandsData.commands
table.sort(commands, function (a,b) return (a[4] < b[4]) end)
-- create the header of the table
local header = "<table class=\"wikitable sortable\"> \n "
header = header .. "<tr> \n "
header = header .. "<th>Уровень<br>доступа</th> \n "
header = header .. "<th>Команда</th> \n "
header = header .. "<th>Быстрый вызов</th> \n "
header = header .. "<th>Описание</th> \n "
header = header .. "<th>Аргументы</th> \n "
header = header .. "</tr> \n "
wiki = header
for k,v in pairs(commands) do
local row = ''
row = row .. "<tr> \n "
if (v.parent == nil) then v.parent = '' else v.parent = v.parent .. " " end
if (v.parameters ~= nil) then
v.parameters= '-'
else v.parameters= ''
end
if (v.shortCut ~= '') then v.shortCut = "/".. v.shortCut end
row = row .. "<td>" .. v.level.. " </td> \n"
row = row .. "<td>/" .. v.parent .. v.command.. " </td> \n"
row = row .. "<td>" .. v.shortCut.. " </td> \n"
row = row .. "<td>" .. v.helpText.. " </td> \n"
row = row .. "<td></td> \n"
row = row .. "</tr>"
wiki = wiki .. row
end
wiki = wiki .. " </table>"
return wiki
end
return p