Version 1.1.4
- typos in descriptions - ambiguous variable definitions - bumped version for all versions of WoW (Classic Era, WotLK, Retail) - added TOCs for all versions of WoW, removed release script
This commit is contained in:
+23
-21
@@ -5,7 +5,9 @@ local Grichelde = _G.Grichelde or {}
|
||||
-- constants and upvalues
|
||||
Grichelde.LOG_LEVEL = { DEBUG = 1, TRACE = 2 }
|
||||
|
||||
-- chat input in client is limited to 255 bytes (unicode length is less)
|
||||
Grichelde.INPUT_LIMIT = 255
|
||||
-- safety measure in case malformed user input causes infinite loops on string parsing
|
||||
Grichelde.ENDLESS_LOOP_LIMIT = 10000
|
||||
Grichelde.MAPPING_OFFSET = 10
|
||||
Grichelde.MINIMAP_ENABLED = 1.0
|
||||
@@ -169,11 +171,11 @@ local function nilOrEmpty(s)
|
||||
return s == nil or s:trim() == ""
|
||||
end
|
||||
|
||||
local function spairs(t, orderFunc)
|
||||
local function spairs(tbl, orderFunc)
|
||||
-- collect the keys
|
||||
local sortedKeys = {}
|
||||
-- for every non-nil value
|
||||
for key, _ in Grichelde.F.pairs(t) do
|
||||
for key, _ in Grichelde.F.pairs(tbl) do
|
||||
Grichelde.F.tInsert(sortedKeys, key)
|
||||
end
|
||||
|
||||
@@ -189,22 +191,22 @@ local function spairs(t, orderFunc)
|
||||
return function()
|
||||
it = it + 1
|
||||
if (sortedKeys[it] ~= nil) then
|
||||
return sortedKeys[it], t[sortedKeys[it]]
|
||||
return sortedKeys[it], tbl[sortedKeys[it]]
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function tFilter(t, condition, extract)
|
||||
local function tFilter(type, condition, extract)
|
||||
local filtered = {}
|
||||
for key, value in Grichelde.F.pairs(t) do
|
||||
for key, value in Grichelde.F.pairs(type) do
|
||||
local cond = false
|
||||
if (condition) then
|
||||
local t = Grichelde.F.type(condition)
|
||||
if (t == "function") then
|
||||
cond = condition(t, key, value)
|
||||
elseif (t == "string") or (t == "number") then
|
||||
local typ = Grichelde.F.type(condition)
|
||||
if (typ == "function") then
|
||||
cond = condition(typ, key, value)
|
||||
elseif (typ == "string") or (typ == "number") then
|
||||
cond = (value == condition)
|
||||
end
|
||||
end
|
||||
@@ -212,7 +214,7 @@ local function tFilter(t, condition, extract)
|
||||
if (cond) then
|
||||
local val = value
|
||||
if (extract and (Grichelde.F.type(extract) == "function")) then
|
||||
val = extract(t, key, value)
|
||||
val = extract(type, key, value)
|
||||
end
|
||||
Grichelde.F.tInsert(filtered, val)
|
||||
end
|
||||
@@ -220,20 +222,20 @@ local function tFilter(t, condition, extract)
|
||||
return filtered
|
||||
end
|
||||
|
||||
local function tSize(t)
|
||||
local function tSize(tbl)
|
||||
local size = 0
|
||||
if (t ~= nil) then
|
||||
if (tbl ~= nil) then
|
||||
-- for every non-nil value
|
||||
for _, _ in Grichelde.F.pairs(t) do
|
||||
for _, _ in Grichelde.F.pairs(tbl) do
|
||||
size = size + 1
|
||||
end
|
||||
end
|
||||
return size
|
||||
end
|
||||
|
||||
local function tIsEmpty(t)
|
||||
if (not t) then return true end
|
||||
return Grichelde.F.tNext(t) == nil
|
||||
local function tIsEmpty(tbl)
|
||||
if (not tbl) then return true end
|
||||
return Grichelde.F.tNext(tbl) == nil
|
||||
end
|
||||
|
||||
local function tClone(orig)
|
||||
@@ -323,11 +325,11 @@ local function isCapital(word)
|
||||
return false
|
||||
else
|
||||
local first, rest = Grichelde.F.getNextCharUtf8(word)
|
||||
local isCapital = Grichelde.F.isUpper(first)
|
||||
local isCap = Grichelde.F.isUpper(first)
|
||||
if (rest ~= nil) then
|
||||
return isCapital and Grichelde.F.isLower(rest)
|
||||
return isCap and Grichelde.F.isLower(rest)
|
||||
else
|
||||
return isCapital
|
||||
return isCap
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -346,8 +348,8 @@ local function capitalize(word)
|
||||
end
|
||||
end
|
||||
|
||||
local function color(color, text)
|
||||
return color .. text .. Grichelde.COLOR_CODES.CLOSE
|
||||
local function color(colour, text)
|
||||
return colour .. text .. Grichelde.COLOR_CODES.CLOSE
|
||||
end
|
||||
|
||||
local function cPrefix(text)
|
||||
|
||||
Reference in New Issue
Block a user