MrDaGree/ELS-FiveM

Implement Utility Functions

Closed this issue · 0 comments

lze3 commented

Instead of using and proof-checking all cases of global function usage within the code base. Provide wrapper-ish functions which do all the proof-checking for you within the function handler, i.e.

(nil):lower() -- equivalent to string.lower(nil) | throws error

With wrapper:

string_lower = function(str)
    if str and type(str) == "string" then
        return str:lower()
    end
end

string_lower(nil) -- returns nil and not an error