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 ASCII_PRINTABLE = {33,126} | |
local function genpass(len) | |
local amin,amax = (table.unpack or unpack)(ASCII_PRINTABLE) | |
local pass = {} | |
for i = 1,len do | |
pass[i] = math.random(amin,amax) | |
end | |
return string.char((table.unpack or unpack)(pass)) | |
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
local foo,bar | |
function foo(x) function bar(x) | |
bar(x) foo(x) | |
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
local foo,bar | |
function foo(...) -- local | |
end | |
function bar(...) -- local | |
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
mod:provider 'health' { | |
function(unit, event, ...) | |
if some_example then | |
return -- return nothing to not update frames | |
end | |
return UnitHealth(unit), UnitHealthMax(unit) -- returned values get sent as signal to unit frame | |
end, | |
updatefor = {'.*'}, -- invoke for all units | |
unitevents = {'UNIT_HEALTH','UNIT_MAXHEALTH'}, -- invoke for event's arg1 unit on these events | |
events = { ['.*'] = 'PLAYER_ENTERING_WORLD' }, -- also invoke on PEW for all valid units |
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
-- Dead | |
mod:provider 'dead' { | |
function(unit) | |
local isdead = UnitIsDead(unit) | |
local isghost = UnitIsGhost(unit) | |
return isdead,isghost | |
end, | |
updatefor = {'.*'}, | |
events = { | |
['player'] = {'PLAYER_DEAD','PLAYER_UNGHOST','PLAYER_ALIVE'} |
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
nametext:Listen('name',function(self,name,realm) | |
name = mod.abbrev_shortname(name) | |
if UnitCanAttack('player','targettarget') then | |
name = '|cff993333>|r '..name | |
else | |
name = '|cffffffff>|r '..name | |
end | |
self:SetText(name) | |
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
-- Namespace | |
local _,mod = ... | |
-- Example | |
mod:provider 'example' { | |
function(unit) |
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 tooltip | |
local function create_tooltip() | |
local tip, fontstrings = CreateFrame("GameTooltip", "temptt"), {} | |
for i = 1, 8 do | |
local L,R = tip:CreateFontString(), tip:CreateFontString() | |
L:SetFontObject(GameFontNormal) | |
R:SetFontObject(GameFontNormal) | |
tip:AddFontStrings(L,R) | |
table.insert(fontstrings,L) | |
table.insert(fontstrings,R) |
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 tooltip | |
local function create_tooltip() | |
local tip, fontstrings = CreateFrame("GameTooltip", "temptt", nil, "GameTooltipTemplate"), {} | |
for i = 1, 8 do | |
local L,R = tip:CreateFontString(), tip:CreateFontString() | |
L:SetFontObject(GameFontNormal) | |
R:SetFontObject(GameFontNormal) | |
tip:AddFontStrings(L,R) | |
table.insert(fontstrings,L) | |
table.insert(fontstrings,R) |
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
C:\Users\Neffi | |
λ lua | |
Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio | |
> local t={}; for i = 1,950000 do t[i]='a' end; local tprime = table.pack(table.unpack(t,1,#t/2)); print(#tprime) | |
475000 | |
> local t={}; for i = 1,1000000 do t[i]='a' end; local tprime = table.pack(table.unpack(t,1,#t/2)); print(#tprime) | |
500000 | |
> local t={}; for i = 1,1200000 do t[i]='a' end; local tprime = table.pack(table.unpack(t,1,#t/2)); print(#tprime) | |
600000 | |
> local t={}; for i = 1,2200000 do t[i]='a' end; local tprime = table.pack(table.unpack(t,1,#t/2)); print(#tprime) |