Last active
August 29, 2015 13:57
-
-
Save profan/9555326 to your computer and use it in GitHub Desktop.
Search for a function through table, print names of matching functions.
This file contains 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
function findFunction(search_table, funcname) | |
for k, v in pairs(search_table) do | |
if type(v) == "table" then | |
for i, l in pairs(v) do | |
if type(l) == "function" then | |
if string.match(i, funcname) then | |
io.write(k .. ".".. i .. "\n"); | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output for: findFunction(_G, "match");
//string.match
//string.gmatch
Given Lua 5.0.