795 - Method to add own LuaText default codes
What is the enhancement in mind? How should it look and feel?
A method to add own "PROVIDED_CODES (custom default texts) to LuaTexts module.
Why could this usefull?
Imagine a module that provides some new method to be used by LuaTexts, eg. r, g, b = GetStanceColor(), IsUnitKillOnSight(unit) and the author wanted to give user's some predefined LuaText code to introduce the new features or to make user's live easier (because user's are always lazy :) ).
Please provide any additional information below.
Afaik this shouldn't be hard to implement. The biggest change needed is in PitBull4_LuaTexts:SetLayoutOptionsFunction(...), wer the 'default_codes' get-ter and set-ter functions need to be tuned to handle additional PROVIDED_CODES and the values entry needs be be updated as well.
| Name | Description | Size | MD5 |
|---|---|---|---|
| ExampleHack.lua | Code that enables adding own ... | 3.3 KiB | 63e8a55433c7... |
| User | When | Change |
|---|---|---|
| CommanderSirow | Sep 20, 2010 at 19:52 UTC | Added attachment ExampleHack.lua |
| CommanderSirow | Sep 20, 2010 at 19:45 UTC | Create |
- 5 comments
- 5 comments
Facts
- Last updated
- Mar 11, 2013
- Reported
- Sep 20, 2010
- Status
- New - Issue has not had initial review yet.
- Type
- Enhancement - A change which is intended to better the project in some way
- Priority
- Medium - Normal priority.
- Votes
- 0
- Component
- LuaTexts
- Reply
- #5
Shefki Sep 22, 2010 at 04:20 UTC - 0 likesLeaving ticket open for now. Since I don't want to forget this request.
- Reply
- #4
Shefki Sep 22, 2010 at 04:19 UTC - 0 likesProbably isn't in the documentation since it's an AceAddon API.
Thanks.
- Reply
- #3
CommanderSirow Sep 21, 2010 at 17:07 UTC - 0 likesYes this ticket is definitely a superset of mine, with better modularity. As far as I'm concerned, this ticket can be considered closed (or duplicate). :)
Offtopic:
Thanks for the tip, was browsing the PitBull4 API manual, but could not find any PitBull4:GetModule(name) only PitBull4:IterateModulesOfType(...), will resort to ingame Lua Browser next time.
Didn't know/think about this implication, have removed OptionalDeps line from my addon.
To be honest I totally forget about DogTags. I'll need to do some recap to see if/how to support it.
Removed my hacky LuaText injection code. It did bug me anyway how easily it might break, if some internals change.
- Reply
- #2
Shefki Sep 21, 2010 at 02:24 UTC - 0 likesYou went to an awful lot of trouble to do something that you could have just asked and probably gotten the code change. It would have been far better for you to suggest a method of expanding this rather than giving me code of how you hacked it in.
Iterating modules just to find the module when you could do: PitBull4:GetModule() or PitBull4.LuaTexts.
Your module has load system issues. I'm not 100% sure which issue is the case but one of these two problems apply:
a) LoadOnDemand modules get loaded by OptionalDeps and you force LuaTexts to load for any user of your module that has DogTagTexts disabled from within PitBull4 but not at the addon selection screen.
b) LoadOnDemand modules do not get loaded by OptionalDeps and your addon may not always inject properly because then there's no guarantee LuaTexts is loaded when your OnEnable function runs.
As far as adding support for this. It very likely depends upon: http://www.wowace.com/addons/pitbull4/tickets/431-code-section-to-reuse-lua-texts-or-dog-tags/
While I'm not putting a ton of effort into supporting DogTags as a library, I really do not want to start adding things to LuaTexts that drifts it towards the only text provider module.
If we provide that other ticket then whatever we add to the LuaTexts module now will be thrown away anyway. So I'm disinclined to add an API that I know is going to be obsoleted.
If you wanted to put some work into providing an API and possibly the ticket I linked along with it, I'll look at it and we'll see.
As it stands, I'm highly opposed to your hack being released to users in the wild.
- Reply
- #1
CommanderSirow Sep 20, 2010 at 19:54 UTC - 0 likesAbout ExampleHack.lua:
This code enables adding own default codes for a third party addon.
It ignores any local variable/function in PitBull4_LuaTexts.lua because it was a quick hack for my own pitbull module, which sadly does not have access to any local. :(
This is only to demonstrate where to start working. ;)