Base class implementation for Lua
You can:
- clone the repository:
git clone https://github.com/a1div0/lua-object.git
- install the
lua-object
module usingtarantoolctl
:
tarantoolctl rocks install https://raw.githubusercontent.com/a1div0/lua-object/main/lua-object-1.0.3-1.rockspec
local Object = require('lua-object')
local NewClass = Object:extend()
local NewClassChild = NewClass:extend()
local obj = NewClass:new(a, b, c...)
function NewClass:initialize(a, b, c...)
---
end
initialize
- is key word
function NewClass:method1(a, b, c...)
---
end
function NewClassChild:method1(a, b, c...)
---
NewClass.method1(self, a, b, c...)
---
end
if obj.myInstance(NewClass) then
---
end
local Object = require('lua-object')
local BaseTable = Object:extend()
function BaseTable:myFunction1(arg1, arg2, arg3)
--
-- ...
--
end
local tableA = BaseTable:new()
if tableA:isInstance(Object) then
tableA:myFunction1(1, 2, 3)
end