Simple but Powerful OOP library
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc-md
rockspecs
src
test
.gitignore
.travis.yml
LICENSE.md
README.md
install.sh

README.md

Klesi

Lua Class System; Simple but Powerful

Klesi is "class" in Lojban - a logical language. Klesi is designed from the ground up to be simple to use, and easy to expand on.

Example

local Object = require("klesi")

local Foo = Object:expand()

function Foo:new(a)
  self.a = a
end

function Foo:geta()
  return self.a
end

local Bar = Foo:extend()

function Bar:geta()
  return self.a * 2
end

local obj = Bar(5)

-- `a` is multiplied by 2
print(obj:geta()) --> 10

-- `a` returns the same amount, now that it's cast
print(obj:cast(Foo):geta()) --> 5