Happy Early Access Launch! Please bear with us: We're doing our best to get the site updated. If we currently don't have what you're looking for, try checking our sister site, beastieball.info.

If you're looking to contribute to the site, we're happy to have you! Check out Beastiepedia:To Do List to see what needs done.

Find us in the Wishes Unlimited Discord in the "Beastiepedia: The Beastieball Wiki" thread in the Forums!

Module:HelperFunctions: Difference between revisions

From Beastiepedia: The Beastieball Wiki
(Created page with "-- Module for various useful helper functions local p = {} function p.sum(...) local result = 0 for i,arg in ipairs(arg) do result = result + arg end return result end return p")
 
mNo edit summary
Line 4: Line 4:
function p.sum(...)
function p.sum(...)
     local result = 0
     local result = 0
     for i,arg in ipairs(arg) do
     for i,v in ipairs(arg) do
         result = result + arg
         result = result + v
     end
     end



Revision as of 23:35, 19 November 2024

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

-- Module for various useful helper functions
local p = {}

function p.sum(...)
    local result = 0
    for i,v in ipairs(arg) do
        result = result + v
    end

    return result
end

return p