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

Материал из Posmotrelisu
Перейти к навигации Перейти к поиску
 
(не показаны 82 промежуточные версии этого же участника)
Строка 1: Строка 1:
local p = {};
local p = {}


p.test = function ( frame )
p.sortlist = function (frame)
return "Ad Victoriam!"
local args = require('Module:Arguments').getArgs(frame)
end
 
p.randElem = function ( frame )
local cnt=0


-- Код курильщика
local otstup= ' • '
for i, val in ipairs(frame.args) do
local list_end= ' … '
cnt=i
end


local time=os.time()
if args['отступ'] ~= nil then otstup=args['отступ'] end


return time.." "..cnt.." "..frame.args[time%cnt]
local res_t = {}
local res=""


for i in ipairs(args) do
table.insert (res_t, args[i])
end
end


table.sort (
res_t,
function (a, b) return a < b end
)


for i in ipairs(res_t) do
res=res..res_t[i]..otstup
end


 
return res..list_end
 
end


return p
return p

Текущая версия на 15:06, 11 февраля 2025

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

local p = {}

p.sortlist = function (frame)
local args = require('Module:Arguments').getArgs(frame)

local otstup= ' • '
local list_end= ' … '

if args['отступ'] ~= nil then otstup=args['отступ'] end

local res_t = {}
local res=""

for i in ipairs(args) do
table.insert (res_t, args[i])
end

table.sort (
res_t,
function (a, b) return a < b end
)

for i in ipairs(res_t) do
res=res..res_t[i]..otstup
end

return res..list_end
end

return p