Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/script_engine/lunartest2.lua @ 8261

Last change on this file since 8261 was 8061, checked in by bensch, 19 years ago

merged the scriptengine back to the trunk

File size: 665 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  print('a =', a)
22  print('b =', b)
23  print('metatable =', getmetatable(a))
24  print('Account =', Account)
25  table.foreach(Account, print)
26
27  a:show() a:deposit(50.30) a:show() a:withdraw(25.10) a:show()
28  Obj:printName()
29
30  return 2
31  --debug.debug()
32end
Note: See TracBrowser for help on using the repository browser.