Help fixing my addon with new API
Hello all! I maintain a simple Broker data addon for displaying backpack-tracked currencies called Broker_Wallet. I haven't really had to touch it in like, 10 years? I am very a very amateur coder and I am completely baffled as to how to call the new currency functions. Can anyone push me in the right direction?
Here is the main code: Code:
local LDB = LibStub:GetLibrary("LibDataBroker-1.1") |
Many API functions that have many returns are being changed into returning a table.
Instead of the following: local first, second, third = GetDataStuff()We get a table: local table = GetDataStuff()And the table looks like this: table = {In your code, instead of:first = "1st",} local name, isHeader, isExpanded = C_Currency.GetCurrencyListInfo( i )You use: local table = C_Currency.GetCurrencyListInfo( i )Then you can use the following: table.nameBecause we no longer have control over the variable names returned, you'll have to consult API documentation ingame or on third party websites, or use the command /dump to print out the table. The following command will dump currency info on Coalescing Visions: /dump C_Currency.GetCurrencyInfo(1755)A negative side effect of returning tables is memory leaks. If you are using these table-returning functions a lot, such as every frame, each previous table is still there, just waiting to be garbage collected. Too much of these tables in a short time frame will cause the game to temporarily freeze or just slow down for less than a second in order for Lua to release some of this memory. It's not really an issue on beefy CPUs, but it is a very noticeable problem on weaker computers. Keep this in mind when using these functions. |
Thank you for the reply. I am not sure if I can make it work like it used to without a ton of work, sadly. But I think this can get me started. Cheers.
|
All times are GMT -6. The time now is 06:00 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI