This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- READ ONLY FORM | |
local mt = {} -- The real metatable | |
local mt_proxy = {} -- The object returned by getmetatable() | |
setmetatable(mt_proxy,{ | |
__index = function(self,k) return mt[k] end, -- Allow the proxy to read fields. use a function so it's opaque (user cannot access real metatable) | |
__newindex = function() end -- But writing is a nop (otherwise we may accidentally barr access to __index) | |
}) | |
mt.__metatable = mt_proxy -- Make getmetatable() return the proxy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local mt,mt_proxy = {},{} | |
setmetatable(mt_proxy,{ __index = mt }) | |
mt.__metatable = mt_proxy | |
test = {} | |
setmetatable(test,mt) | |
-- add `__newindex = mt` to line 2 for full read/write | |
-- or make __newindex a special filtering function to allow writing only some metamethods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local top = math.max(f1:GetTop(),f2:GetTop()) | |
local bottom = math.min(f1:GetBottom(),f2:GetBottom()) | |
local left = math.min(f1:GetLeft(),f2:GetLeft()) | |
local right = math.max(f1:GetRight(),f2:GetRight()) | |
local w,h = UIParent:GetWidth(),UIParent:GetHeight() | |
f3:ClearAllPoints() | |
f3:SetPoint('TOPLEFT',UIParent,'TOPLEFT',h-top,left) | |
f3:SetPoint('BOTTOMRIGHT',UIParent,'BOTTOMRIGHT',bottom,w-right) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local mystring = "0513|0625|0929" -- and so on | |
local a = {} | |
local i = 1 | |
for num in mystring:gmatch('[^|]+') do | |
a[i] = num | |
i = i + 1 | |
end | |
table.sort(a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function foo() | |
return foo() | |
end | |
local bar; bar = function() | |
return bar() | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- With select('#') and recursion | |
do | |
local function _tsa(n,a,...) | |
if n > 0 then | |
return tostring(a),_tsa(n-1,...) | |
end | |
end | |
function tostringall(...) | |
local n = select('#',...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The below code is hereby released into the Public Domain. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
OTHER DEALINGS IN THE SOFTWARE. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local WHITELIST = {[8122]=1,[408]=1,[1833]=1,[6770]=1,[2094]=1,[118]=1,[82691]=1,[71757]=1,[12598]=1,[122]=1,[33395]=1,[83302]=1,[76577]=1,[12357]=1,[44572]=1,[55021]=1, | |
[2823]=1,[108215]=1,[108212]=1,[137573]=1, -- REMOVE FOR FINAL. ONLY FOR TESTING | |
} | |
--[=[ | |
local buttons = {} | |
for i = 1,5 do | |
local i = i -- Store the unit ID in an upvalue | |
buttons['arena'..i] = setmetatable({},{__index = function(self,b) | |
--[[ build button i ]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/run _SSP={[42292]=1,[59752]=1,[8122]=1,[408]=1,[1833]=1,[6770]=1,[2094]=1,[118]=1,[82691]=1,[71757]=1,[12598]=1,[122]=1,[33395]=1,[83302]=1,[76577]=1,[12357]=1,[44572]=1,[55021]=1} | |
/run f=CreateFrame'Frame'f:RegisterEvent'UNIT_SPELLCAST_SUCCEEDED'f:SetScript('OnEvent',function(s,e,u,_,_,_,p)if u:find'arena'and _SSP[p]then SendChatMessage(GetSpellInfo(p)..' used by: '..GetUnitName(u),'PARTY') end end) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The below code is hereby released into the Public Domain. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
OTHER DEALINGS IN THE SOFTWARE. | |