Print to file in case it doesn't fit in console

This commit is contained in:
FPtje 2016-04-29 20:41:29 +02:00
parent 257fd127c1
commit 97fed941e1
2 changed files with 11 additions and 6 deletions

View File

@ -20,8 +20,8 @@ local color_name = Color(260, 150, 30)
local color_reference = Color(150, 230, 50)
local color_comment = Color( 30, 210, 30)
-- Global 'nil' value
NIL = {}
-- 'nil' value
local NIL = {}
-- Localise for faster access
local pcall = pcall
@ -570,13 +570,13 @@ local toStringMsgC = function(_, txt)
end
function showStr(...)
local oldF, oldN, oldMsgC = gMsgF, gMsgN, MsgC
gMsgF, gMsgN, MsgC = toStringMsgF, toStringMsgN, toStringMsgC
local oldF, oldN, oldMsgC, oldMsgN = gMsgF, gMsgN, MsgC, MsgN
gMsgF, gMsgN, MsgC, MsgN = toStringMsgF, toStringMsgN, toStringMsgC, toStringMsgN
strResult = {}
show(...)
gMsgF, gMsgN, MsgC = oldF, oldN, oldMsgC
gMsgF, gMsgN, MsgC, MsgN = oldF, oldN, oldMsgC, oldMsgN
return table.concat(strResult, "")
end

View File

@ -344,7 +344,12 @@ function FUNCDETAILS:Init()
self.toConsole:Dock(BOTTOM)
function self.toConsole:DoClick()
show(FProfiler.UI.getCurrentRealmValue("currentSelected"))
local data = FProfiler.UI.getCurrentRealmValue("currentSelected")
show(data)
file.CreateDir("fprofiler")
file.Write("fprofiler/profiledata.txt", showStr(data))
MsgC(Color(200, 200, 200), "-----", Color(120, 120, 255), "NOTE", Color(200, 200, 200), "---------------\n")
MsgC(Color(200, 200, 200), "If the above function does not fit in console, you can find it in data/fprofiler/profiledata.txt\n\n")
end
end