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

Материал из Posmotrelisu
Перейти к навигации Перейти к поиску
Строка 32: Строка 32:
local pos=1 -- итерируемая позиция в разбираемом шаблоне
local pos=1 -- итерируемая позиция в разбираемом шаблоне
local result = {} -- массив частей html-кода для последующей склейки
local result = {} -- массив частей html-кода для последующей склейки
local args={}


function header ()
function header ()
 
local body="</tr><tr><td>"
 
if args[pos+1] == nil then return end
local body = "</tr><tr><td>"..args[pos+1].."</td>"
pos=pos+2
table.insert (result, body)
end
end



Версия 12:28, 10 июля 2024

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

local p = {}; 

p.test = function ( frame )
return "Ad Victoriam!"
end

p.randElem = function ( frame )
local cnt=0

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

local time=os.time()

return time.."  "..cnt.." "..frame.args[time%cnt+1]

end


p.iter_test = function ( frame )
local base=""
for name, val in pairs(frame.args) do
base=base..'<br> key: '..name..' zn: '..val
end
return base

end


local pos=1 -- итерируемая позиция в разбираемом шаблоне
local result = {} -- массив частей html-кода для последующей склейки
local args={}

function header ()
local body="</tr><tr><td>"
if args[pos+1] == nil then return end
local body = "</tr><tr><td>"..args[pos+1].."</td>"
pos=pos+2
table.insert (result, body)
end

function list ()

end  

return p