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:
Scorpio "ScorpioTest" "1.0.0"
-- Register and handle system event
__SystemEvent__()
function UNIT_SPELLCAST_START(unit, spell)
print(unit .. " cast " .. spell)
end
-- Secure hook apis in an addon
__AddonSecureHook__ "Blizzard_AuctionUI"
function AuctionFrameTab_OnClick(self, button, down, index)
print("Click " .. self:GetName() .. " Auction tab")
end
-- Define a slash command "/sct cd 10", used to count down per sec
__SlashCmd__ "sct" "cd"
__Async__() -- Mark the function as a thread
function CountDown(cnt)
cnt = tonumber(cnt)
if cnt then
for i = floor(cnt), 1, -1 do
print(i)
Delay(1) -- Delay 1 sec, can only be used in a thread
end
end
end
You can find more details in the
Page.
Here is an example addon :
Enhance BattlefieldMinimap