User Tools

Site Tools


luar-studio:addons

Lua test code: base.lua

-- Meta class
Shape = {area = 0}

-- Base class method new

function Shape:new (o,side)
   o = o or {}
   setmetatable(o, self)
   self.__index = self
   side = side or 0
   self.area = side*side;
   return o
end

-- Base class method printArea

function Shape:printArea ()
   print("The area is ",self.area)
end

luar-studio/addons.txt · Last modified: 2018/02/19 03:24 by tbulford