dev console fix (duplicating strings after reloading)

This commit is contained in:
Azumgi 2018-01-24 18:01:27 +03:00
parent 6dcca6c594
commit 4cc3a49153

View file

@ -1,21 +1,22 @@
DEV_CONSOLE_ENABLED = DEV_CONSOLE_ENABLED or false DEV_CONSOLE_ENABLED = DEV_CONSOLE_ENABLED or false
local print_original_function = print if DEV_CONSOLE_ENABLED == false then
local print_hook_function = function(func, ...) local print_original_function = print
local print_hook_function = function(func, ...)
if DEV_CONSOLE_ENABLED then if DEV_CONSOLE_ENABLED then
CommandWindow.print(...) CommandWindow.print(...)
func(...) func(...)
else else
func(...) func(...)
end end
end end
print = function(...) print = function(...)
print_hook_function(print_original_function, ...) print_hook_function(print_original_function, ...)
end end
if DEV_CONSOLE_ENABLED == false then
CommandWindow.open("Developer console") CommandWindow.open("Developer console")
DEV_CONSOLE_ENABLED = true DEV_CONSOLE_ENABLED = true
end end