admicos 4 Posted November 30, 2016 Share Posted November 30, 2016 aclass is a lightweight and easy class system. Yes this is the third time i wrote that line. Anyways: How to make a class: Since i'm not that great at documentation, you might want to check the example afterwards. Also, this relies on some Lua formatting tricks to stay readable-ish, so expect some weird syntax To make a class, you use the class function as demonstrated here: class "classname" { "optional parent class"; variable = "hello"; constructor = function(self, hello) --# Constructor is optional self:parentConstructor() --# Runs the parent classes constructor. self.hello = hello or "world" --# Example variable change. end; func = function(self) print(self.variable) end; } To use the class in your program, you use the new function as demonstrated here: local myClass = new "classname"("constructor", "ar", "gs", 1234) --# While the constructor args are optional, the paranthesis are required print(myClass.variable) myClass:func() Examples: One example can be found here Downloads: Available though oppm as aclass Direct Link: https://raw.githubusercontent.com/OpenPrograms/admicos-Programs/master/aclass/aclass.lua Quote Link to post Share on other sites
admicos 4 Posted December 2, 2016 Author Share Posted December 2, 2016 aclass has updated. To load aclass, you now do local new, class = require("aclass")() and it will return the new and class functions as locals instead of globals. And printing the class variable will return "class: ClassName" instead of "table: 0xhexcode" Quote Link to post Share on other sites