Created
October 15, 2023 18:55
-
-
Save dextercd/793612f919c0f33c991e5ac9f8ff6b1f to your computer and use it in GitHub Desktop.
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
local lua_appends = {} | |
---@param path string | |
---@return string[] | |
local function impl_get(path) | |
local result = {} | |
dofile = function(appended) | |
table.insert(result, appended) | |
end | |
do_mod_appends(path) | |
return result | |
end | |
---Returns the Lua files that were appended to the given script | |
---@param path string Path to the script you want to get appends of | |
---@return string[] | |
function lua_appends.get(path) | |
local dofile_restore = dofile | |
local status, ret = pcall(impl_get, path) | |
dofile = dofile_restore | |
if not status then | |
error(ret) | |
end | |
return ret | |
end | |
return lua_appends |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
!