13 Days Ago
Return nil on file.Read not found as opposed to no value (as wiki suggests) (#2241) https://wiki.facepunch.com/gmod/file.Read suggests that the return data should be `The data from the file as a string, or nil if the file isn't found.` print(type(file.Read("a.txt", "DATA"))) > no value This results in unexpected behaviour, for example trying to tonumber the results of file.Read will error, while this function can normally handle nil values - it cant handle no values. print(file.Read("a.txt", "DATA")) -- nil print(file.Read("a.txt", "DATA")==nil) -- true tonumber(nil) -- no error , returns nil tonumber(file.Read("a.txt", "DATA")) -- bad argument #1 to 'tonumber' (value expected)