Skip to content

acleverpun/caste

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caste

A lua class system, built in moonscript, on top of the moonscript class implementation.

Probably works in native lua, too, but I have not yet tested it.

Overview

TODO. But look at lib/caste.moon until then. Classes have names, types, and some other stuff.

Install

Just add as a submodule to your project:

git submodule add https://github.com/acleverpun/caste.git vendor/caste

Use

Simply require caste to use it.

Caste = require('vendor/caste/lib/caste')

class Foo extends Caste

Background

I actually think moonscript looks quite ugly... I was never a fan of its inspirations, coffeescript and ruby. To be fair, many of its ugly parts are opt-in (like optional parens for function calls. I always use parens!). Despite the ugliness, moonscript adds many great things to lua and as such is worth using in my opinion. Its class implementation is one of those gems---I honestly feel like moonscript's classes are the best in the entire lua ecosystem, and one of the many things that I very much enjoy working with.

In making a LÖVE project (found here), I wanted a way to use libraries that are built on top of Middleclass, without actually using Middleclass. I posted about my struggle here, and of course since this is way over the heads of most people that use LÖVE, nobody cared. I was able to use my solution to extend lovetoys classes.

Ultimately, I started getting frustrated with lovetoys. I have made quite a few pull requests, but kept getting mad because I found the library was more and more broken as I did more with it. After I found a completely library-breaking bug so bad that I really don't understand how anyone has been using the library at all over the past few years, I decided to make my own ECS. In doing so, I stopped using my creative middleclass-proxy solution, but took the mains parts with me. Thus this should actually be compatible with middleclass, though to what extent I can no longer say.

Build

This project uses the make build automation tool. All build targets can be found in the makefile, and all scripts in the ./scripts directory.

# build project
make
# or
make build

# clean dist files
make clean

# watch filesystem and build when changes are made
make watch

# run linter on project
make lint

Contributing

Please feel free to contribute. Also feel free to open issues, ask questions, make suggestions, etc.

About

A lua class implementation, built in Moonscript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published