-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathinit.lua
More file actions
47 lines (36 loc) · 860 Bytes
/
init.lua
File metadata and controls
47 lines (36 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
-- Debugging is on by default
local M = {}
-- Use rawget to satisfy std.strict.
local _DEBUG = rawget (_G, "_DEBUG")
-- User specified fields.
if type (_DEBUG) == "table" then
M._DEBUG = _DEBUG
-- Turn everything off.
elseif _DEBUG == false then
M._DEBUG = {
argcheck = false,
call = false,
deprecate = false,
level = math.huge,
}
-- Turn everything on (except _DEBUG.call must be set explicitly).
elseif _DEBUG == true then
M._DEBUG = {
argcheck = true,
call = false,
deprecate = true,
}
else
M._DEBUG = {}
end
local function setdefault (field, value)
if M._DEBUG[field] == nil then
M._DEBUG[field] = value
end
end
-- Default settings if otherwise unspecified.
setdefault ("argcheck", true)
setdefault ("call", false)
setdefault ("deprecate", nil)
setdefault ("level", 1)
return M