Alguém Me ajuda
[06/10/2018 22:16:58] [Error - LuaScriptInterface::loadFile] datapack/lib/addon.lua:1: unexpected symbol near 'ï'
ADDON_LIMIT = 5 --Limite de addons que um poke pode ter
local ADDON_BASE_STRING = string.rep("0;", ADDON_LIMIT) --String base no formato: "0;0;0;0;0;"
local function checkAddonTableConsistency(tab)
if #tab < ADDON_LIMIT then --proteção para quando muda o ADDON_LIMIT
for i = #tab+1, ADDON_LIMIT do
tab = 0
end
end
end
function updateAddonAttr(uid, attr, value, pos)
local tmp = getItemAttribute(uid, attr) or ADDON_BASE_STRING
tmp = type(tmp) == "string" and tmp or ADDON_BASE_STRING
local t = string.explode(tmp, ";")
checkAddonTableConsistency(t)
if pos > 0 and pos <= ADDON_LIMIT then
t[pos] = value
return doSetItemAttribute(uid, attr, table.concat(t, ";"))
else
return false
end
end
function getAddonValue(uid, attr)
local tmp = getItemAttribute(uid, attr) or ADDON_BASE_STRING
tmp = type(tmp) == "string" and tmp or ADDON_BASE_STRING
tmp = string.explode(tmp, ";")
local pos = getItemAttribute(uid, "current_addon") or 0
checkAddonTableConsistency(tmp)
if pos > 0 and pos <= ADDON_LIMIT then
return tonumber(tmp[pos])
else
return 0
end
end
function getAddonCount(uid)
local tmp = getItemAttribute(uid, "addon")
if type(tmp) ~= "string" then return 0 end
local t = string.explode(tmp, ";")
checkAddonTableConsistency(t)
local count = 0
for _,v in ipairs(t) do
if tonumber(v) ~= 0 then count = count + 1 end
end
return count
end
function getAddonTotalLook(value)
local str = {}
addonValue = 0
for addonList = 1, 5 do
local addons = tostring(value:explode(";")[addonList])
if addons ~= '0' then
addonValue = addonValue + 1
end
end
addonValue = addonValue == 0 and "Não possui addon." or addonValue
return addonValue
end