lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Yes, really!

http://www.cowlark.com/objective-lua

@interface Point : Object
@end

@implementation MyClass
  - init
    [super init]
    self.x = 0
    self.y = 0
    return self
  end

  - initX: x Y: y
    self.x = x
    self.y = y
    return self
  end

  - x
    return self.x
  end

  - y
    return self.y
  end

  - moveToX: x Y: y
    self.x = x
    self.y = y
  end

  - moveByX: x Y: y
    self.x = self.x + x
    self.y = self.y + y
  end
@end

local point = [[Point alloc] init]
[point moveToX: 4 Y: 9]

--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "They laughed at Newton. They laughed at Einstein. Of course, they
│ also laughed at Bozo the Clown." --- Carl Sagan