ಮಾಡ್ಯೂಲ್:Toolbar: ಪರಿಷ್ಕರಣೆಗಳ ನಡುವಿನ ವ್ಯತ್ಯಾಸ

Content deleted Content added
ಚು Protected Module:Toolbar: High-risk Lua module ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))
simplifying - the original was probably good practice for me, but this version is better code in the circumstances
೧ ನೇ ಸಾಲು:
local p = {}
local args = {}
 
-- Create concatenator object.
local Concatenator = {result = ''}
 
function Concatenator:new()
local o = {}
setmetatable(o, self)
self.__index = self
return o
end
 
function Concatenator:add(s)
if type(s) ~= 'string' then
error('Attempt to concatenate non-string value', 2)
end
self.result = self.result .. s
end
 
-- Get the keys of the numerical arguments that are present.
Line ೩೮ ⟶ ೨೧:
-- Generate the toolbar items.
local tiret = Concatenator:new()''
for i, v in ipairs(nums) do
ti:add(ret = ret .. args[v])
if nums[i + 1] then
ti:add(ret = ret .. sep)
end
end
return ti.resultret
end
 
Line ೫೧ ⟶ ೩೪:
local class = args.class or ''
local style = (args.style and ('style="' .. args.style .. '"')) or ''
local t = Concatenator:new()
-- Generate opening span tag.
t:add('<span class="plainlinks ')
t:add(class)
t:add('" ')
t:add(style)
t:add('>')
-- Generate toolbar items.
t:add('(')
t:add(makeToolbarItems())
t:add(')')
local ret = '<span class="plainlinks ' .. class .. '" ' .. style .. '>'
-- Generate closing span tag.
t:add .. '(' .. makeToolbarItems() .. ')'
t:add( .. '</span>')
return t.result ret
end
 
"https://kn.wikipedia.org/wiki/ಮಾಡ್ಯೂಲ್:Toolbar" ಇಂದ ಪಡೆಯಲ್ಪಟ್ಟಿದೆ