"모듈:연습장/배우는사람/Bananas"의 두 판 사이의 차이

편집 요약 없음
local p = {}
 
 
-----------------------------------------------------------------------------------------------------------
function p.custom_fruit_2(frame)
local name = frame.args[1]
local result = name .. 'has:'
local count = 0
for name, value in pairs(frame.args) do
if name ~= 1 then
count = count + 1
if count == 1 then
result = result .. ' ' .. value .. ' ' .. name
else
result = result .. ', ' .. value .. ' ' .. name
end
end
end
end
 
 
-- Iterating over args with separate mandatory args
-- Used like: {{#invoke:BananasArgs|custom_fruit_2|Fred|pineapples=10|kiwis=5}}
--function p.custom_fruit_2(frame)
-- local name = frame.args[1]
-- local result = name .. ' has:'
-- for name, value in pairs(frame.args) do
-- if name ~= 1 then
-- result = result .. ' ' .. value .. ' ' .. name
-- end
-- end
-- return result
--end
 
-----------------------------------------------------------------------------------------------------------