Hello, I am trying to format ability description, but something went wrong
The main function i work with:
local replicatedStorage = game:GetService('ReplicatedStorage')
local descriptions = require(replicatedStorage.Descriptions)
local DescFormat = require(replicatedStorage.Descriptions.Format)
local rarityHEX,rarityLET = require(replicatedStorage.RarityHEX),require(replicatedStorage.RarityLetter)
local abilitiesData = require(replicatedStorage.AbilityData)
return function(ability,rank)
local abilityData = abilitiesData[ability]
local descData = abilityData.Description
local stats = abilityData.Stats
local ustats = abilityData.UStats
for i=1,#descData do
local v = descData[i]
if v == 'RANK' then
descData[i] = rank
elseif v:find('STAT') then
local _,f2 = v:find('STAT')
local n = tonumber(v:sub(f2+1,f2+1))
if v:sub(1,1) == 'U' then
descData[i] = tonumber(ustats[n])
else
descData[i] = tonumber(stats[n] + ustats[n] * (rank-1))
end
end
end
print(typeof(descData[1]))
print(descData)
print(unpack(descData))
print(descriptions[ability])
print(descriptions[ability]:format(unpack(descData)))
return DescFormat(string.format(descriptions[ability],unpack(descData)))
end
The error appears when im trying to use string.format in main function in this line:
print(descriptions[ability]:format(unpack(descData)))
The output:
I put %d for numbers in description, I expect it to put four numbers from descData variable in my description string, but it says “missing argument #6”. Please help