I guess the file declares its functions as global, or it would be really easy to track what is returned.
If that's the case, you can cycle through all the global items with a generic for loop, and only take the functions from them:
allFuncs = {} for key, item in pairs(_G) do if type(item) == "function" then allFuncs[#allFuncs + 1] = item end end
(_G is the table holding all the global variables)
Then you will have a list (allFuncs) holding all the functions declared, but be aware that it will also contain default functions like setmetatable or xpcall.
It's easy to modify the code to not make this happen, but only use this for testing / learning:
function allFuncs() local funcsTab = {} for key, item in pairs(_G) do if type(item) == "function" then funcsTab[#funcsTab + 1] = item end end return funcsTab end defaultFuncs = allFuncs() --then you load your file: other functions get declared --we create another table containg the default + the new functions myFuncs = allFuncs() --then you subtract the first table from the second for i = 1, #myFuncs do for o = 1, #defaultFuncs do if myFuncs[i] == defaultFuncs[o] then table.remove(myFuncs, i) end end end
This is if your file doesn't return anything and declares its functions as globals.
If the file declares them as local and then returns a table containing them, just use the first piece of code replacing _G with that returned table.