Modul:Discipline/ability: Unterschied zwischen den Versionen

CamNet - das Wiki
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
(Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt)
Zeile 38: Zeile 38:
local args = getArgs(frame)
local args = getArgs(frame)
local name = args.name or args[1] or mw.title.getCurrentTitle().prefixedText
local name = args.name or args[1] or mw.title.getCurrentTitle().prefixedText
local me = Class:new(mw.title.getCurrentTitle().prefixedText .. '_ability_' .. stringHash(name))
local level = args.level or args[2] or mw.title.getCurrentTitle().id
--local me = Class:new(mw.title.getCurrentTitle().prefixedText .. '_ability_' .. stringHash(name .. '_' .. level))
local me = Class:new(Class:getUidFromArgs(args))
me:initFromArgs(args)
me:initFromArgs(args)
me:storeData()
me:storeData()

Aktuelle Version vom 15. März 2016, 20:38 Uhr

Documentation icon Module documentation

This module implements template {{Discipline/ability}}.

Usage

{{#invoke:Discipline/ability|main}}

It also provides some additional "gateways" to some of Module:Discipline/ability/class's static methods:

{{#invoke:Discipline/ability|categorize}}
{{#invoke:Discipline/ability|categoryPage}}
{{#invoke:Discipline/ability|explainDataStore}}
{{#invoke:Discipline/ability|gardeningCategoryPage}}
{{#invoke:Discipline/ability|sfGenerateForm}}
{{#invoke:Discipline/ability|sfGenerateFormEntry}}
{{#invoke:Discipline/ability|sfGenerateFormLink}}
{{#invoke:Discipline/ability|templateDocumentation}}

Maintenanace notes

This page was created by Module:Classgenerator and belongs to Class:Discipline/ability.

local p = {}
local Class = require('Module:Discipline/ability/class')
local getArgs = require('Module:Arguments').getArgs

local function stringHash(text)
	local counter = 1
	local len = string.len(text)
	for i = 1, len, 3 do 
	counter = math.fmod(counter*8161, 4294967279) +  -- 2^32 - 17: Prime!
		(string.byte(text,i)*16776193) +
		((string.byte(text,i+1) or (len-i+256))*8372226) +
		((string.byte(text,i+2) or (len-i+256))*3932164)
	end
	return math.fmod(counter, 4294967291) -- 2^32 - 5: Prime (and different from the prime in the loop)
end

function p.categorize(frame)
	return tostring(Class:categorize())
end

function p.categoryPage(frame)
	return tostring(Class:categoryPage())
end

function p.explainDataStore(frame)
	return tostring(Class:explainDataStore())
end

function p.gardeningCategoryPage(frame)
	return tostring(Class:gardeningCategoryPage())
end

function p.templateDocumentation(frame)
	return tostring(Class:templateDocumentation())
end

function p.main(frame)
	local args = getArgs(frame)
	local name = args.name or args[1] or mw.title.getCurrentTitle().prefixedText
	local level = args.level or args[2] or mw.title.getCurrentTitle().id
	--local me = Class:new(mw.title.getCurrentTitle().prefixedText .. '_ability_' .. stringHash(name .. '_' .. level))
	local me = Class:new(Class:getUidFromArgs(args))
	me:initFromArgs(args)
	me:storeData()
--	me:addInfobox()
	me:addPageBody()
 	return me:render()
end

return p