Ketho / vscode-wow-api

VS Code extension for World of Warcraft AddOns
https://marketplace.visualstudio.com/items?itemName=ketho.wow-api
MIT License
155 stars 33 forks source link

LibSharedMedia Request data param #170

Closed Noshei closed 2 hours ago

Noshei commented 2 weeks ago

The Request function in LibSharedMedia supports both string and integer. In the Annotation file it is set to only support string.

Can this be updated in the annotations file to support both, thanks.

Ketho commented 3 hours ago

Uhm which "Request" function do you mean? I don't see any in https://www.wowace.com/projects/libsharedmedia-3-0/pages/api-documentation

Noshei commented 3 hours ago

ah typo on my part, I meant Register. Which is documented as only being a string, but is implemented to allow for a string or a number.

Noshei commented 3 hours ago

as an example, this will work to register the correct sound media:Register("sound", "Auction Window Open", 567482)

but this wont register anything: media:Register("sound", "Auction Window Open", "567482")

Ketho commented 3 hours ago

as an example, this will work to register the correct sound media:Register("sound", "Auction Window Open", 567482)

but this wont register anything: media:Register("sound", "Auction Window Open", "567482")

Huh I'm confused, the data argument is documented as a string type in their docs. But in your example you're saying this FileID as a number works, but does not work not as a string; and in the original issue you wanted it to be marked as a string|integer type? 😕

Noshei commented 3 hours ago

so the actual code for Register is a bit messy, but it accepts both string and number.

If you want to register a file from your addon you can do so with the file path as a string: media:Register("font", "Fira Mono Medium", "Interface\\Addons\\GatheringTracker\\Media\\Fonts\\FiraMono-Medium.ttf")

This will work just fine. And some blizzard files will also work this way, but others will only work with the FileID and when you use a FileID in the Register function, it needs to be a number to register correctly.