local currentResourceName = GetCurrentResourceName()

local debugIsEnabled = GetConvarInt(('%s-debug'):format(currentResourceName), 0) == 1

function debugPrint(...)
  if not debugIsEnabled then return end

  local args <const> = { ... }

  local appendStr = ''
  for _, v in ipairs(args) do
    appendStr = appendStr .. ' ' .. tostring(v)
  end
  local msgTemplate = '^3[%s]^0%s'
  local finalMsg = msgTemplate:format(currentResourceName, appendStr)
  print(finalMsg)
end

function printTable(tbl, indent)
  if not indent then indent = 0 end
  for k, v in pairs(tbl) do
    formatting = string.rep("  ", indent) .. k .. ": "
    if type(v) == "table" then
      print(formatting)
      printTable(v, indent+1)
    elseif type(v) == 'boolean' then
      print(formatting .. tostring(v))
    else
      print(formatting .. v)
    end
  end
end

function getTableKeys(tbl)
  local keys = {}
  for k,_ in pairs(tbl) do
    keys[#keys+1] = k
  end
  return keys
end