File: test.lua

package info (click to toggle)
tagua 1.0~alpha2-15
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 8,028 kB
  • ctags: 7,178
  • sloc: cpp: 26,149; ansic: 13,039; makefile: 182; ruby: 87; sh: 39
file content (45 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (6)
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
function out(x)
  dump(x, "", "")
end

function dump(x, indent1, indent2)
  mt = getmetatable(x)
  if mt then
    io.write("> metatable: ")
    dump(mt, "", indent2 .. "  ")
    io.write("> object: ")
  else
    io.write(indent1)
  end
  if type(x) == "string" then
    io.write(x)
  elseif type(x) == "number" then
    io.write(x)
  elseif type(x) == "table" then
    print("{")
    for k, v in pairs(x) do
      dump(k, indent2 .. "    ", indent2 .. "    ")
      io.write(" = ")
      dump(v, "", indent2 .. "    ")
      print("")
    end
    print(indent2 .. "}")
  else
    io.write("<" .. type(x) .. ">")
  end
end

function debug()
  print "Rect"
  out(Rect)
  print ""
  
  print "r"
  out(r)
  print ""
end

r = Rect(2, 3, 100, 400)
print(r:height())