Skip to content

Instantly share code, notes, and snippets.

@dacap
Created January 13, 2022 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dacap/0c5b5f7def685194fab4526d9cf1c6c4 to your computer and use it in GitHub Desktop.
Save dacap/0c5b5f7def685194fab4526d9cf1c6c4 to your computer and use it in GitHub Desktop.
Get the current Lua script filename
function script_filename()
local source = debug.getinfo(2, "S").source
if source:sub(1, 1) == "@" then
return source:sub(2)
else
return ""
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment