summaryrefslogtreecommitdiff
path: root/Tools/LuaMacro/tests/mod.m.lua
blob: 50151e63ab512aebda6fd03641d134706216d74e (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
require_ 'module'

local function dump(text)
  print (text)
end

function one ()
  return two()
end

class Fred

  function _init(self,x)
    @set(x or 1)
  end

  function set(self,x)
    @x = x
  end

  function get(self)
    return @x
  end

  function set2(self)
    @set(0)
  end

end

class Alice : Fred
  function __tostring(self)
    return "Alice "..tostring(@x)
  end

  function set2(self)
    @set(1)
  end
end


function two ()
  return 42
end