dump.lua 827 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. local snapshot = require "snapshot"
  2. local snapshot_utils = require "snapshot_utils"
  3. local construct_indentation = snapshot_utils.construct_indentation
  4. local print_r = require "print_r"
  5. local S1 = snapshot()
  6. local tmp = {
  7. player = {
  8. uid = 1,
  9. camps = {
  10. {campid = 1},
  11. {campid = 2},
  12. },
  13. },
  14. player2 = {
  15. roleid = 2,
  16. },
  17. [3] = {
  18. player1 = 1,
  19. },
  20. }
  21. local a = {}
  22. local c = {}
  23. a.b = c
  24. c.d = a
  25. local msg = "bar"
  26. local foo = function()
  27. print(msg)
  28. end
  29. local co = coroutine.create(function ()
  30. print("hello world")
  31. end)
  32. local S2 = snapshot()
  33. local diff = {}
  34. for k,v in pairs(S2) do
  35. if not S1[k] then
  36. diff[k] = v
  37. end
  38. end
  39. print_r(diff)
  40. print("===========================")
  41. local result = construct_indentation(diff)
  42. print_r(result)