3 -- ignore things that change on different machines or every release
4 -- the following items still have to exist, but their values don't have to match
6 -- differences by machine
12 "run_user_scripts_when_superuser",
15 -- differences in Lua versions
18 "utf8.charpattern" -- some versions allow overlong encodings
21 -- the following items don't have to exist
23 -- deprecated in Lua 5.3, removed in Lua 5.4
24 -- but might appear in 5.4 with 5.3 backwards compatibility mode
25 "bit32", -- 5.3+ has bitwise operators, we include BitOp
26 "math.atan2", -- use math.atan with two arguments
28 "math.log10", -- call math.log with second argument
31 "math.pow", -- use x^y
33 "math.ldexp", -- use x * 2.0^exp
37 "debug.setcstacklimit", -- function that existed in 5.4.1, stub-only in 5.4.2+
42 local arg
={...} -- get passed-in args
44 -- arg1 = path to find inspect
45 -- arg2 = filename to read in (optional, unless 'verify' is set)
46 -- arg3 = 'verify' to verify all of read-in file is in _G (default); 'new' to output all items in _G that are not in read-in file
47 -- arg4 = 'nometa' to ignore metatables; 'meta' otherwise (default)
49 local add_path
= "lua/?.lua;"
51 add_path
= arg
[1].."?.lua;"
54 print("package.path = " .. package
.path
)
56 -- need the path to find inspect.lua
57 local old_path
= package
.path
58 package
.path
= add_path
.. package
.path
60 local inspect
= require("inspect")
62 package
.path
= old_path
-- return path to original
64 print("-- Wireshark version: " .. get_version())
67 -- no more args, so just output globals
68 print(inspect(_G
, { serialize
= true, filter
= inspect
.makeFilter(filter
) }))
72 local file
= assert(io
.open(arg
[2], "r"))
73 local input
= file
:read("*all")
74 input
= inspect
.marshal(input
)
77 if #arg
> 3 and arg
[4] == "nometa" then
81 if #arg
== 2 or arg
[3] == "verify" then
82 print(string.rep("\n", 2))
83 print("Verifying input file '"..arg
[2].."' is contained within the global table")
84 local ret
, diff
= inspect
.compare(input
, _G
, {
85 ['filter'] = inspect
.makeFilter(filter
),
86 ['ignore'] = inspect
.makeFilter(ignore
),
91 print("Comparison failed - global table does not have all the items in the input file!")
92 print(string.rep("\n", 2))
93 print(string.rep("-", 80))
94 print("Differences are:")
97 print("\n-----------------------------\n")
98 print("All tests passed!\n\n")
101 elseif #arg
> 2 and arg
[3] == "new" then
102 local ret
, diff
= inspect
.compare(_G
, input
, {
103 ['filter'] = inspect
.makeFilter(filter
),
104 ['ignore'] = inspect
.makeFilter(ignore
),
112 print("\n-----------------------------\n")
113 print("No new items!\n\n")