file.Exists Bad Argument

Hi I am working on an admin mod and it has been fine on gmod 10/11 but on 13 its misbehaving!


function EV.LogEvent(Text)
 local Date = string.gsub(os.date("%x"), "/", "-")
 local FName = "EVLogs/"..Date..".txt"
 Text = "("..os.date("%X")..") "..Text
 if(file.Exists(FName)) then
  local LastText = file.Read(FName)
  Text = LastText..Text..".
"
 else
  Text = Text..".
"
 end
 file.Write(FName, Text)
end

Which spits out:


Hook 'EV.PlayerInitialSpawn' Failed: [@addons\evo x\lua\ev_core\ev_core.lua:63] bad argument #2 to 'Exists' (string expected, got no value)
 unknown lua\includes\modules\hook.lua:77
E

Any help?

As your question/request is related to LUA you should consider taking a look at the Facepunch LUA Section. LUA Developers ain’t very active in the Help & Support section so you should try to post a thread in the Question or Request sub-forums of the Facepunch LUA Section!