Differenze tra le versioni di "Modulo:Wikilib/games"

Added isInGen
(Creata pagina con "--This module contains utility functions and data related to games -- local g = {} local txt = require('Modulo:Wikilib/strings') local tab = require('Modulo:Wikilib/t...")
 
(Added isInGen)
local tab = require('Modulo:Wikilib/tables')
local formUtil = require('Modulo:Wikilib/forms')
local gensgenUtil = require('Modulo:Wikilib/gens')
local gendata = mw.loadData('Modulo:Gens/data')
local alts = formUtil.allFormsData()
--]]
if abbr == 'base' then
return gensgenUtil.getGen.game(game)
>= gensgenUtil.getGen.ndex(ndex)
end
 
 
g.is_in_game, g.isingame = g.isInGame, g.isInGame
 
--[[
 
Returns whether the passed Pokémon is
present in the given generation.
Alternative forms can also be checked,
by passing the Pokémon name as the usual
name + abbreviation.
 
--]]
g.isInGen = function(poke, gen)
local baseForm, abbr = formUtil.getNameAbbr(poke)
 
if not abbr or abbr == '' then
return genUtil.getGen.ndex(pokes[baseForm].ndex) <= gen
end
 
return g.anyInGen(gen, formUtil.formSpan(baseForm, abbr))
end
g.isingen, g.is_in_gen = g.isInGen, g.isInGen
 
--[[
--]]
if type(from) ~= 'table' and not to then
return gensgenUtil.getGen.game(from) <= gen
end