View Single Post
02-07-17, 02:51 AM   #1
kurapica.igas
A Chromatic Dragonspawn
Join Date: Aug 2011
Posts: 152
Scorpio A new addon framework

Scorpio is my new addon framework, its non-ui part is finished, so I can share it now.

I have some posts about changing code environment, in the Scorpio, I had provide some special code style based on the environment control like :

Lua Code:
  1. Scorpio "ScorpioTest" "1.0.0"
  2.  
  3. -- Register and handle system event
  4. __SystemEvent__()
  5. function UNIT_SPELLCAST_START(unit, spell)
  6.     print(unit .. " cast " .. spell)
  7. end
  8.  
  9. -- Secure hook apis in an addon
  10. __AddonSecureHook__ "Blizzard_AuctionUI"
  11. function AuctionFrameTab_OnClick(self, button, down, index)
  12.     print("Click " .. self:GetName() .. " Auction tab")
  13. end
  14.  
  15. -- Define a slash command "/sct cd 10", used to count down per sec
  16. __SlashCmd__ "sct" "cd"
  17. __Async__()   -- Mark the function as a thread
  18. function CountDown(cnt)
  19.     cnt = tonumber(cnt)
  20.     if cnt then
  21.         for i = floor(cnt), 1, -1 do
  22.             print(i)
  23.             Delay(1)        -- Delay 1 sec, can only be used in a thread
  24.         end
  25.     end
  26. end

You can find more details in the Page.

Here is an example addon : Enhance BattlefieldMinimap

Last edited by kurapica.igas : 04-19-18 at 09:49 PM.
  Reply With Quote