4,951
edits
Falterfire (talk | contribs) (Created a currently empty p.getItemCategories function) |
Falterfire (talk | contribs) (Added ability to force number formatting on getItemStat) |
||
Line 103: | Line 103: | ||
local StatName = args[2] | local StatName = args[2] | ||
local ZeroIfNil = args.ForceZero ~= nil and args.ForceZero ~= '' and args.ForceZero ~= 'false' | local ZeroIfNil = args.ForceZero ~= nil and args.ForceZero ~= '' and args.ForceZero ~= 'false' | ||
local FormatNum = args.FormatNum ~= nil and args.FormatNum ~= '' and args.FormatNum ~= 'false' | |||
local item = p.getItem(ItemName) | local item = p.getItem(ItemName) | ||
if item == nil then | if item == nil then | ||
return "ERROR: No item named "..ItemName.." exists in the data module" | return "ERROR: No item named "..ItemName.." exists in the data module" | ||
end | end | ||
local result = p._getItemStat(item, StatName, ZeroIfNil) | |||
if FormatNum then result = Shared.formatnum(result) end | |||
return result | |||
end | end | ||