-- Homework 27, problem 1 -- solution. local Point = {} Point.__index = Point function Point.new(x, y) local self = setmetatable({}, Point) self.x = x self.y = y return self end function Point:distance(other) local dx = self.x - other.x local dy = self.y - other.y return math.sqrt(dx * dx + dy * dy) end function Point:move(dx, dy) self.x = self.x + dx self.y = self.y + dy end local a = Point.new(0, 0) local b = Point.new(3, 4) print(a:distance(b)) a:move(1, 1) print(a.x, a.y) print(a:distance(b))