Skip to content

Instantly share code, notes, and snippets.

@subsoap
Created August 8, 2020 03:56
Show Gist options
  • Save subsoap/b019739dbb095d7bb263539fe2622568 to your computer and use it in GitHub Desktop.
Save subsoap/b019739dbb095d7bb263539fe2622568 to your computer and use it in GitHub Desktop.
-- save reference to original function
local local_print = print
-- replace with our custom function
print = function(...)
-- print stacktrace
local_print(debug.traceback())
-- call original function
local_print(...)
end
print("test")
@subsoap
Copy link
Author

subsoap commented Aug 8, 2020

This will monkey patch a Lua script so that you can find where the prints are. Useful if you have commented may prints out too. You can easily make a pprint() variant as well.

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