×
Create a new article
Write your page title here:
We currently have 1,393 articles on World Trigger Wiki. Type your article name above or create one of the articles listed here!



    World Trigger Wiki
    Revision as of 19:36, May 14, 2024 by Lord-Giganticus (talk | contribs) (Created page with "local Stat = {} Stat.__index = Stat function Stat:new(trion, attack, defense, mobility, skill, range, mechanical_operation, data_analysis, parallel_processing, tactics, command, special_tactics) local res = Stat setmetatable(res, Stat) res.trion = tonumber(trion) or 0 res.attack = tonumber(attack) or 0 res.defense = tonumber(defense) or 0 res.mobility = tonumber(mobility) or 0 res.skill = tonumber(skill) or 0 res.range = tonumber(rang...")
    (diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

    local Stat = {}
    Stat.__index = Stat
    
    function Stat:new(trion, attack, defense, mobility, skill, range, mechanical_operation, data_analysis,
        parallel_processing, tactics, command, special_tactics)
        local res = Stat
        setmetatable(res, Stat)
        res.trion = tonumber(trion) or 0
        res.attack = tonumber(attack) or 0
        res.defense = tonumber(defense) or 0
        res.mobility = tonumber(mobility) or 0
        res.skill = tonumber(skill) or 0
        res.range = tonumber(range) or 0
        res.mechanical_operation = tonumber(mechanical_operation) or 0
        res.data_analysis = tonumber(data_analysis) or 0
        res.parallel_processing = tonumber(parallel_processing) or 0
        res.tactics = tonumber(tactics) or 0
        res.command = tonumber(command) or 0
        res.special_tactics = tonumber(special_tactics) or 0
        return res
    end
    
    function Stat:from_table(table)
        return Stat:new(table[1], table[2], table[3], table[4], table[5], table[6], table[7],
        table[8], table[9], table[10], table[11], table[12])
    end
    
    function Stat.total(self)
        local t = 0
        for _, v in pairs(self) do
            if type(v) == "number" then
                t = t + v
            end
        end
        return t
    end
    
    local util = require("Module:Util")
    
    function Stat:from_frame(frame)
        local args, _ = util.get_args_and_pargs(frame)
        return Stat:from_table(args)
    end
    
    ---@param path string
    function Stat:from_json(path)
        local stats = {}
        local data = mw.loadJsonData(path)
        local i = 0
        for _, v in ipairs(data) do
            stats[i] = Stat:from_table(v)
            i = i + 1
        end
        return stats
    end
    
    function Stat:from_data(path)
        local stats = {}
        local data = mw.loadData(path)
        local i = 0
        for _, v in ipairs(data) do
            stats[i] = Stat:from_table(v)
            i = i + i
        end
        return stats
    end
    
    return Stat
    
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.

    Recent changes

  • Fairemont • 2 days ago
  • Fairemont • 2 days ago
  • Fairemont • 2 days ago
  • Fairemont • 2 days ago
  • Welcome to WorldTriggerWiki.com!

    We have completed moving the wiki here from FANDOM. This is the wiki that will be maintained and updated in the future (more information). Enjoy your stay!


    If you would like to get involved, or if you have questions or feedback, check out the Community Portal.

    Happy Birthday!

    June 30

    Takeru Yuiga

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.