Skip to content

uleelx/lupy

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

lupy

A small Python-style OO implementation for Lua. It also gains some good features from Ruby.
It has been tested on Lua 5.2.3 using the examples in repo. Welcome to fork and test it more.

Philosophy

"Things should be as simple as possible, but no simpler." [1]

Usage

Copy lupy.lua file to your project or where your lua libraries stored.
Then write this in any Lua file where you want to use it:

local class = require 'lupy'

More usage can be found in the examples.

Quick Look

local class = require 'lupy'

class [[Person]]

  function __init__(self, name)
    self.name = name
  end

  function say(self, msg)
    print(self.name.." says: "..msg)
  end

_end()

local I = Person("Peer")

I.say("Hello world!")

-- Peer says: Hello world!

Features

  • Python-like constructor, method definition, instance creating and method calling
  • Ruby-like inheritance, mixins, missing methods handler and monkey patching
  • lexical scope based encapsulation
  • inheritance tree based type testing
  • namespace and inner class support
  • metamethods support
  • class property support
  • abstract method support

License

lupy is distributed under the MIT license.

About

A small Python-style OO implementation for Lua

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages