Module:Test: Difference between revisions

From Roat Pkz
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:


-- Function to calculate percentages
-- Function to calculate percentages
function Test.calculatePercentages(number)
function Test.calculatePercentages(args)
    local number = tonumber(args[1]) or 0 -- Extract the number from the table
     local percentages = {}
     local percentages = {}
     -- Original number
     -- Original number

Revision as of 22:43, 3 April 2024

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

-- This is a Lua module for MediaWiki
-- It provides functionality to calculate percentages of a number

-- Create a table to hold the functions
local Test = {}

-- Function to calculate percentages
function Test.calculatePercentages(args)
    local number = tonumber(args[1]) or 0 -- Extract the number from the table
    local percentages = {}
    -- Original number
    table.insert(percentages, number)
    -- 10% increase
    table.insert(percentages, number * 1.10)
    -- 20% increase
    table.insert(percentages, number * 1.20)
    -- 30% increase
    table.insert(percentages, number * 1.30)
    
    return percentages
end

-- Export the module
return Test