summaryrefslogtreecommitdiff
path: root/Tools/lua-snapshot/dump.lua
blob: 640ea2c5e4b52e54a11a64999b9b9144d8dfab0f (plain)
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
48
49
50
51
local snapshot = require "snapshot"
local snapshot_utils = require "snapshot_utils"
local construct_indentation = snapshot_utils.construct_indentation
local print_r = require "print_r"

local S1 = snapshot()

local tmp = {
    player = {
        uid = 1,
        camps = {
            {campid = 1},
            {campid = 2},
        },
    },
    player2 = {
        roleid = 2,
    },
    [3] = {
        player1 = 1,
    },
}

local a = {}
local c = {}
a.b = c
c.d = a

local msg = "bar"
local foo = function()
    print(msg)
end

local co = coroutine.create(function ()
    print("hello world")
end)

local S2 = snapshot()

local diff = {}
for k,v in pairs(S2) do
	if not S1[k] then
        diff[k] = v
	end
end

print_r(diff)
print("===========================")

local result = construct_indentation(diff)
print_r(result)