Module:DropsLineTest: Difference between revisions

From Roat Pkz
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
local p = {}
-- Define a function to generate output numbers based on the input
-- Define a function to generate output numbers based on the input
local function generateOutput(input)
function p.generateOutput(frame)
    local inputNumber = tonumber(frame.args[1]) or 0
     local output = {}
     local output = {}


     -- Add the input number
     -- Add the input number
     table.insert(output, input)
     table.insert(output, inputNumber)


     -- Calculate and add percentages
     -- Calculate and add percentages
     table.insert(output, input * 0.1) -- 10%
     table.insert(output, inputNumber * 0.1) -- 10%
     table.insert(output, input * 0.2) -- 20%
     table.insert(output, inputNumber * 0.2) -- 20%
     table.insert(output, input * 0.3) -- 30%
     table.insert(output, inputNumber * 0.3) -- 30%
     table.insert(output, input * 0.4) -- 40%
     table.insert(output, inputNumber * 0.4) -- 40%
     table.insert(output, input * 0.5) -- 50%
     table.insert(output, inputNumber * 0.5) -- 50%


     return output
     return table.concat(output, ', ')
end
end
return p

Revision as of 17:07, 5 May 2024

Documentation for this module may be created at Module:DropsLineTest/doc

local p = {}

-- Define a function to generate output numbers based on the input
function p.generateOutput(frame)
    local inputNumber = tonumber(frame.args[1]) or 0
    local output = {}

    -- Add the input number
    table.insert(output, inputNumber)

    -- Calculate and add percentages
    table.insert(output, inputNumber * 0.1) -- 10%
    table.insert(output, inputNumber * 0.2) -- 20%
    table.insert(output, inputNumber * 0.3) -- 30%
    table.insert(output, inputNumber * 0.4) -- 40%
    table.insert(output, inputNumber * 0.5) -- 50%

    return table.concat(output, ', ')
end

return p