Toggle menu
1.3K
1.7K
695
23.9K
Veloren Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Weapon: Difference between revisions

From Veloren Wiki
Content added Content deleted
No edit summary
No edit summary
Line 5: Line 5:
p.getWeapon = function(frame)
p.getWeapon = function(frame)
local weapon = frame.args[1]
local weapon = frame.args[1]
local txt = nil
for i=1, #weapons_table, 1 do
for i=1, #weapons_table, 1 do
if weapons_table[i]['name'] == weapon then
if weapons_table[i]['name'] == weapon then
Line 15: Line 14:
speed = weapons_table[i]['speed']
speed = weapons_table[i]['speed']
critchance = weapons_table[i]['critchance']
critchance = weapons_table[i]['critchance']
txt = txt .. frame:expandTemplate{ title = 'Infobox weapon', args = {title = name} }
local txt = frame:expandTemplate{ title = 'Infobox weapon', args = {title = name} }
end
end
end
end

Revision as of 21:53, 9 December 2021

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

local weapons_table = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{title='Template:Weapons.json'})

local p = {}

p.getWeapon = function(frame)
	local weapon = frame.args[1]
	for i=1, #weapons_table, 1 do
		if weapons_table[i]['name'] == weapon then
			path = weapons_table[i]['path']
			type = weapons_table[i]['type']
			name = weapons_table[i]['name']
			quality = weapons_table[i]['quality']
			damage = weapons_table[i]['damage']
			speed = weapons_table[i]['speed']
			critchance = weapons_table[i]['critchance']
			local txt = frame:expandTemplate{ title = 'Infobox weapon', args = {title = name} }
		end
	end
	return txt
end

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