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
local print_original_function = print
local print_hook_function = function(func, ...)
if DEV_CONSOLE_ENABLED then
CommandWindow.print(...)
func(...)
else
func(...)
end
end
print = function(...)
print_hook_function(print_original_function, ...)
end
if DEV_CONSOLE_ENABLED == false then
local print_original_function = print
local print_hook_function = function(func, ...)
if DEV_CONSOLE_ENABLED then
CommandWindow.print(...)
func(...)
else
func(...)
end
end
print = function(...)
print_hook_function(print_original_function, ...)
end
CommandWindow.open("Developer console")
DEV_CONSOLE_ENABLED = true
end