beenii
Well-Known Member
- Joined
- Jul 26, 2010
- Messages
- 586
- Solutions
- 1
- Reaction score
- 58
Code:
function getWandDmg(itemId)
local file = io.open("data/weapons/weapons.xml", "r")
for info in string.gmatch(file:read("*a"), "<weapons(.-)</weapons>") do
if info:match("wand id=\"(.-)\"") == itemId then
local min = info:match("min=(.-)")
local max = info:match("max=(.-)")
return math.random(min, max)
end
end
file:close()
return nil
end
function getWandType(itemId)
local file = io.open("data/weapons/weapons.xml", "r")
for info in string.gmatch(file:read("*a"), "<weapons(.-)</weapons>") do
if info:match("wand id=\"(.-)\"") == itemId then
local type = info:match("type=(.-)")
return tostring(type)
end
end
file:close()
return nil
end
i try use this function. but in console error of a nil value
i use tfs 0.4