Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/bsp_model/src/lib/script_engine/lunartest.lua @ 8538

Last change on this file since 8538 was 8061, checked in by bensch, 18 years ago

merged the scriptengine back to the trunk

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