The following packages are requried:
- boipushy
- classic
Tech notes
To run a method on a object use : not .
Point = Object:extend()
-- Constructor
function Point:new(x, y)
self.x = x or 0
self.y = y or 0
end
-- Adding a method
function Point:sayCoords()
print("X: " .. self.x .. " Y: " .. self.y)
end
return Point
local Point = require "objectDir.Point"
local p = Point(10, 20)
-- Notice : instead of .
p:sayCoords()