Skip to content

Commit

Permalink
refactor(print): encode functions in tables (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
nullvariable authored Jun 26, 2024
1 parent f255d99 commit cdf840f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion imports/print/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ local levelPrefixes = {

local resourcePrintLevel = printLevel[GetConvar('ox:printlevel:' .. cache.resource, GetConvar('ox:printlevel', 'info'))]
local template = ('^5[%s] %%s %%s^7'):format(cache.resource)
local jsonOptions = { sort_keys = true, indent = true }
local function handleException(reason, value)
if type(value) == 'function' then return tostring(value) end
return reason
end
local jsonOptions = { sort_keys = true, indent = true, exception = handleException }

---Prints to console conditionally based on what ox:printlevel is.
---Any print with a level more severe will also print. If ox:printlevel is info, then warn and error prints will appear as well, but debug prints will not.
Expand Down

0 comments on commit cdf840f

Please sign in to comment.