Skip to content

Instantly share code, notes, and snippets.

@profan
Last active August 29, 2015 13:57
Show Gist options
  • Save profan/9555326 to your computer and use it in GitHub Desktop.
Save profan/9555326 to your computer and use it in GitHub Desktop.
Search for a function through table, print names of matching functions.
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
@profan
Copy link
Author

profan commented Mar 14, 2014

Example output for: findFunction(_G, "match");
//string.match
//string.gmatch

Given Lua 5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment