Getting all functions in a Lua script
<p>I'm trying to figure out a way to get all functions in a Lua script. This script has been compiled into a function through loadfile. For example, I'd want to get every function defined in the script below.</p>

<pre><code>function example1()

end

local function example2()

end

local library = {}

function library:example3()

end

(function()
    -- Functions like this too.
end)
</code></pre>

<p>The names aren't important, I'm just looking for a way to get the actual functions so I can use them in debug.getinfo and get information like the lines they were defined in. I have LuaJIT, if that makes this any easier. Is something like this even possible? Thanks in advance.</p>