Module:ItemsByStat: Difference between revisions

From Deadlock Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:


local selectByStat = function(stat)
local selectByStat = function(stat)
Item = 1
print(Item)
local Item,Value = {},{}
local Item,Value = {},{}
local i = 1
local i = 1
Line 17: Line 19:
end
end
local b = {Item, Value}
local b = {Item, Value}
print(Item)
return b
return b
end
end

Revision as of 07:10, 27 September 2024

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

local p = {}
local data = mw.loadJsonData("Data:ItemData.json")

local selectByStat = function(stat)
	Item = 1
	print(Item)
	local Item,Value = {},{}
	local i = 1

	for m,v in pairs(data) do
		for n,w in pairs(v) do
			if n == stat then 
				Item[i] = v["Name"]
				Value[i] = v[stat]
				i = i+1
				break
			end
		end
	end
	local b = {Item, Value}
	return b
end

p.tablefy = function(frame)
	local stat = frame.args[1]
	local tabledata = selectByStat(stat)
	print(tabledata)
end

return p