Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local HANDLE_FUNCTIONS = {
- Enabled = true,
- On = (function(this)
- this.Enabled = true
- end),
- Off = (function(this)
- this.Enabled = false
- end),
- }
- HackyPrintToggle = {
- CreateHandle = (function(this)
- local handle = {}
- for k, v in pairs(HANDLE_FUNCTIONS) do
- handle[k] = v
- end
- return handle
- end),
- Inject = (function(this, env)
- local targetEnv = env or getfenv(2)
- local handle = this:CreateHandle()
- targetEnv.print = function(...)
- if handle.Enabled then
- print(...)
- end
- end
- return handle
- end)
- }
- return HackyPrintToggle
Add Comment
Please, Sign In to add comment