https://github.com/themusaigen/yacl
Yet another class library for Lua (Lua 5.1, LuaJIT, Lua 5.2, Lua 5.3, Lua 5.4)
https://github.com/themusaigen/yacl
Last synced: 2 months ago
JSON representation
Yet another class library for Lua (Lua 5.1, LuaJIT, Lua 5.2, Lua 5.3, Lua 5.4)
- Host: GitHub
- URL: https://github.com/themusaigen/yacl
- Owner: themusaigen
- License: mit
- Created: 2025-01-22T17:13:38.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-01-23T12:41:42.000Z (4 months ago)
- Last Synced: 2025-01-23T13:38:16.364Z (4 months ago)
- Language: Lua
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yacl
Yet another class library - a library for the Lua language for creating classes. Supports constructors, destructors, inheritance, and custom metamethods (with inheritance from the parent). The main difference from other libraries is the support for Lua Language Server annotations.
## How it implemented? Some history
One day I needed the Lua library to create classes. The basic version, which is an example on [lua.org](https://www.lua.org/pil/16.1.html) or [lua-users.org](http://lua-users.org/wiki/SimpleLuaClasses), didn't suit me. However, the libraries that were publicly available lagged behind in terms of hints to the available entities of your class. After seeing the [generic annotation](https://github.com/LuaLS/lua-language-server/releases/tag/2.5.4) on the [LLS wiki](https://luals.github.io/wiki/) and examples for it, I thought it wouldn't be difficult for me to make a suitable one, but there was a problem with the fact that in 4 years (and even more, maybe) ([the first release of LLS was on December 16, 2021](https://github.com/LuaLS/lua-language-server/releases/tag/2.5.4)), no generic classes appeared in the functionality, only a stub of them. However, it was possible to throw the class type into the generator function. So yes, unlike other libraries that return an object of a class to you by throwing various meta-methods on it, this library returns a generator function, where all the magic happens.
## Installation
Extract content of `src` directory to your `lib` directory.
## Usage / Examples
See `tests/init.lua` file.
## See also
* `yacl` written using [moonly](https://github.com/themusaigen/moonly)
* [LuaLS](https://github.com/LuaLS/lua-language-server).## License
`yacl` licensed under `MIT` license. See `LICENSE` for details.