getn(arg) -> arg.n

This commit is contained in:
Pinya
2018-07-22 16:20:16 +03:00
parent c3fa66a47d
commit 28ac998564
15 changed files with 33 additions and 38 deletions
@@ -98,7 +98,7 @@ local function safecall(func, ...)
-- this safecall is used for optional functions like OnInitialize OnEnable etc. When they are not
-- present execution should continue without hinderance
if type(func) == "function" then
return Dispatchers[getn(arg)](func, unpack(arg))
return Dispatchers[arg.n](func, unpack(arg))
end
end
@@ -203,7 +203,7 @@ end
-- @param addon addon object to embed the libs in
-- @param lib List of libraries to embed into the addon
function AceAddon:EmbedLibraries(addon, ...)
for i=1,getn(arg) do
for i=1,arg.n do
local libname = arg[i]
self:EmbedLibrary(addon, libname, false, 4)
end
@@ -21,7 +21,7 @@ AceConsole.commands = AceConsole.commands or {} -- table containing commands reg
AceConsole.weakcommands = AceConsole.weakcommands or {} -- table containing self, command => func references for weak commands that don't persist through enable/disable
-- Lua APIs
local tconcat, getn, tostring = table.concat, table.getn, tostring
local tconcat, tostring = table.concat, tostring
local type, pairs, error = type, pairs, error
local format, strfind, strsub, upper, lower = string.format, string.find, string.sub, string.upper, string.lower
local max = math.max
@@ -40,7 +40,7 @@ local function Print(self,frame,...)
n=n+1
tmp[n] = "|cff33ff99"..tostring( self ).."|r:"
end
for i=1, getn(arg) do
for i=1, arg.n do
n=n+1
tmp[n] = tostring(arg[i])
end
@@ -21,7 +21,7 @@ local strbyte, strchar, gsub, gmatch, format = string.byte, string.char, string.
local assert, error, pcall = assert, error, pcall
local type, tostring, tonumber = type, tostring, tonumber
local pairs, frexp = pairs, math.frexp
local tconcat, getn = table.concat, table.getn
local tconcat = table.concat
-- quick copies of string representations of wonky numbers
local serNaN = tostring(0/0)
@@ -116,7 +116,7 @@ local serializeTbl = { "^1" } -- "^1" = Hi, I'm data serialized by AceSerializer
function AceSerializer:Serialize(...)
local nres = 1
for i=1,getn(arg) do
for i=1,arg.n do
local v = arg[i]
nres = SerializeValue(v, serializeTbl, nres)
end
@@ -52,7 +52,7 @@ local setmetatable, rawset, rawget = setmetatable, rawset, rawget
local pairs, type, next, tostring, unpack = pairs, type, next, tostring, unpack
local gsub = string.gsub
local floor, max, min, fmod = math.floor, math.max, math.min, math.fmod
local tconcat, getn = table.concat, table.getn
local tconcat = table.concat
-- WoW APIs
local GetTime = GetTime
@@ -126,7 +126,7 @@ Dispatchers[0] = function(func)
end
local function safecall(func, ...)
return Dispatchers[getn(arg)](func, unpack(arg))
return Dispatchers[arg.n](func, unpack(arg))
end
local lastint = floor(GetTime() * HZ)