GetCoinText
Jump to navigation
Jump to search
This function was deprecated in 10.2.6 and will be removed in the next expansion. |
Breaks up an amount of money into gold/silver/copper.
formattedAmount = GetCoinText(amount [, separator])
Arguments
- amount
- number - the amount of money in copper (for example, the return value from GetMoney)
- separator
- string? - a string to insert between the formatted amounts of currency, if there is more than one type
Returns
- formattedAmount
- string - a (presumably localized) string suitable for printing or displaying
Example
GetMoney()
local money = GetMoney()
local gold = floor(money / 1e4)
local silver = floor(money / 100 % 100)
local copper = money % 100
print(("You have %dg %ds %dc"):format(gold, silver, copper))
-- You have 10851g 62s 40c
GetCoinText(amount [, separator])
print(GetCoinText(GetMoney())) -- "10851 Gold, 62 Silver, 40 Copper"
print(GetCoinText(12345678, " ")) -- "1234 Gold 23 Silver 45 Copper"
print(GetCoinText(12345678, "X")) -- "1234 GoldX23 SilverX45 Copper"
GetMoneyString(amount [, separateThousands])
print(GetMoneyString(12345678))
print(GetMoneyString(12345678, true))
1234 56 78 1,234 56 78
GetCoinTextureString(amount [, fontHeight])
print(GetCoinTextureString(1234578))
print(GetCoinTextureString(1234578, 24))
1234 56 78
1234 56 78