Here is a function name register closure which I use to register library names:
The Pool object:
function FooBarPool()
local Names = {}
local self = {}
function self:Register(fFoo,sName)
if(fFoo) then
Names[fFoo] = sName
end
end
function self:GetName(fFoo)
return Names[fFoo] or "N/A"
end
return self
end
Create a Pool object
local Pool = FooBarPool()
Register known library functions
Pool:Register(string.sub,"string.sub")
Pool:Register(string.gsub,"string.gsub")
Pool:Register(string.match,"string.match")
Pool:Register(string.gmatch,"string.gmatch")
Pool:Register(string.find,"string.find")
Pool:Register(string.gfind,"string.gfind")
Pool:Register(string.format,"string.format")
Pool:Register(string.byte,"string.byte")
Pool:Register(string.char,"string.char")
Pool:Register(string.len,"string.len")
Pool:Register(string.lower,"string.lower")
Pool:Register(string.upper,"string.upper")
Pool:Register(string.rep,"string.rep")
Pool:Register(string.reverse,"string.reverse")
for k,v in pairs(string) do
print(tostring(v) .. " : "..Pool:GetName(v))
end