Skip to content

Instantly share code, notes, and snippets.

@dextercd
Created October 15, 2023 18:55
Show Gist options
  • Save dextercd/793612f919c0f33c991e5ac9f8ff6b1f to your computer and use it in GitHub Desktop.
Save dextercd/793612f919c0f33c991e5ac9f8ff6b1f to your computer and use it in GitHub Desktop.
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
@NathanSnail
Copy link

!

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