Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/script_engine/src/lib/script_engine/lunartest2.lua @ 8076

Last change on this file since 8076 was 8076, checked in by snellen, 18 years ago

adapted filename

File size: 726 bytes
Line 
1function printf(...) io.write(string.format(unpack(arg))) end
2
3function Account:show()
4  printf("Account balance = $%0.02f\n", self:balance())
5end
6
7parent = {}
8
9function parent:rob(amount)
10  amount = amount or self:balance()
11  self:withdraw(amount)
12  return amount
13end
14
15getmetatable(Account).__index = parent
16
17function main(arg)
18  io.write("main received ", arg)
19  io.write(" as parameter\n")
20  Obj:printName()
21  io.write("callCount is now",Obj:getCallCount())
22  print('a =', a)
23  print('b =', b)
24  print('metatable =', getmetatable(a))
25  print('Account =', Account)
26  table.foreach(Account, print)
27
28  a:show() a:deposit(50.30) a:show() a:withdraw(25.10) a:show()
29  Obj:printName()
30
31  return 2,false,2.72
32  --debug.debug()
33end
Note: See TracBrowser for help on using the repository browser.