Nathan Cofnas has been suspended for engaging in a witch hunt against a Black professor who apparently killed himself.
I think it’s safe to say that Cofnas would not have placed the late Jason Arday under this much scrutiny if he were White. Indeed, Cofnas was fired from his previous job because of his offensive views on race.
I will link to Cofnas’s investigation into Arday’s history.
The, shall we say, racially motivated people (or are they AIs; hard to tell on today’s internet) at The Motte are, as expected, up in arms about Cofnas’ suspension.
Here is an updated version of sPairs() which won’t raise an error if the table uses functions, booleans, or tables as keys. Like previous version of sPairs(), this function is public domain:
-- Like pairs() but sorted
function sPairs(inTable, sFunc)
if not sFunc then
sFunc = function(a, b)
local ta = type(a)
local tb = type(b)
if(ta == tb) then
if ta == 'number'
then return a < b
end
return tostring(a) <
tostring(b)
end
return ta < tb
end
end
local keyList = {}
local index = 1
for k,_ in pairs(inTable) do
table.insert(keyList,k)
end
table.sort(keyList, sFunc)
return function()
key = keyList[index]
index = index + 1
return key, inTable[key]
end
end
Example usage of the above function:
a={z=1,y=2,c=3,w=4}
for k,v in sPairs(a) do
print(k,v)
end
With a sort function that reverse sorts the elements (assuming all elements are of the same type):
a={z=1,y=2,c=3,w=4}
function revS(a,b)
return a>b
end
for k,v in sPairs(a,revS) do
print(k,v)
end
This improved sorter’s default sort function will no longer raise an error if using unusual table keys (tables, functions, booleans, etc.):
a={}
b={}
a[true]=1
a[function() return 1 end]=2
a[b]=3
a[4]=4
a["5"]=5
for k,v in sPairs(a) do
print(k,v)
end