summaryrefslogtreecommitdiff
path: root/Tools/lua-snapshot/dump.lua
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-11-15 13:53:59 +0800
committerchai <chaifix@163.com>2021-11-15 13:53:59 +0800
commit942a030afd348ab2e02eac8054b43e3c3a72ea48 (patch)
treea13459f39a3d2f1b533fbd1b5ab523d7a621f673 /Tools/lua-snapshot/dump.lua
parente307051a56a54c27f10438fd2025edf61d0dfeed (diff)
*rename
Diffstat (limited to 'Tools/lua-snapshot/dump.lua')
-rw-r--r--Tools/lua-snapshot/dump.lua51
1 files changed, 51 insertions, 0 deletions
diff --git a/Tools/lua-snapshot/dump.lua b/Tools/lua-snapshot/dump.lua
new file mode 100644
index 0000000..640ea2c
--- /dev/null
+++ b/Tools/lua-snapshot/dump.lua
@@ -0,0 +1,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)