What I have so far... But my total is much higher than csinfo which is what you mean by "The total MAX is something like half of the total space (all strings combined), for some weird and unknown reason, if I remember correctly." My total was 7081 while csinfo said 4089 local _writetofile = function(line) -- append to csinfo.log
if not line then return et.G_LogPrint("Line empty\n") end
local status,f,err = pcall(io.open,"csinfo.log","a")
if not f then return et.G_LogPrint(err .."\n") end
if not status then return et.G_LogPrint(f .."\n") end
f:write(line)
f:close()
end
local _ljust = function(s,l,sep) --- Justify to left
if not s then s = "" end
if type(s) ~= "string" then s = tostring(s) end
if not l then return s end
if not sep then sep = " " end
if s:len() == l then return s end
l = l - 1
for k=s:len() , l do s = s .. sep end
return s
end
function et_ConsoleCommand( cmd )
local Arg0 = string.lower( et.trap_Argv(0) )
if Arg0 == "getcsinfo" then
local LOG_WITH_ZERO_LENGTH = false
local cs = { }
local MAX_CONFIGSTRINGS = 1024
local total_length = 0
local Arg1 = string.lower( et.trap_Argv(1) )
if Arg1 == "true" then LOG_WITH_ZERO_LENGTH = true end
for cs_index=1, MAX_CONFIGSTRINGS do
local cs_str = et.trap_GetConfigstring( cs_index-1 ) -- index is -1 since it starts at 0
local cs_len = cs_str:len()
total_length = total_length + cs_len
if cs_len > 0 or LOG_WITH_ZERO_LENGTH then
cs[#cs+1] = _ljust(cs_index-1,4) .. " | " .. _ljust(cs_len,4) .. " | " .. cs_str
end
end
_writetofile("\n\n" .. os.date("%c") .. " " .. et.trap_Cvar_Get('fs_game') .. " " .. et.trap_Cvar_Get('mapname') .. "\nTotal length: " .. total_length .. "\n")
_writetofile(table.concat(cs,"\n"))
et.G_LogPrint("Total length: " .. total_length .. "\n")
end
endAnything you notice that is off?