majesty2450 0 Posted November 10, 2015 Share Posted November 10, 2015 Simple Object (Oriented) Utility Library (SOUL)Latest Release: 0.3.1GitHub Wiki: https://github.com/majesty2450/OpenComputers-SOUL/wikiGitHub Repo: https://github.com/majesty2450/OpenComputers-SOUL SOUL is a library that I created to aid my development of various other libs and programs, it is in a state that I feel lends itself to be shared with the community. There may be issues, but from what I'm doing with it right now it works. Note: It adds a bit of overhead compared to the general imperative approach, but this shouldn't be an issue in most cases. Adds OOP (object oriented programming) functionality in the form of Classes and Mixins: Single Inheritance Multiple Inheritance Constructors Copying Type checking Component checking Here is a stripped example from one of the included tests: Example -- Interface -- local Tastable = {} function Tastable:taste () error("Not Implemented!") end Tastable.garbage_var = "hello" -- Base Class -- local Pizza = Class:extend(Tastable) function Pizza:__init (name) Class.__init(self) self.name = name end -- Sub Class -- local CheesePizza = Pizza:extend() function CheesePizza:__init () Pizza.__init(self, "Cheese") end function CheesePizza:taste () print(self.name .. " is good!") end -- Results -- local instance = CheesePizza:new() local instance2 = Pizza:new() print("Pizza isa Tastable: ", Pizza:isa(Tastable)) print("Pizza isa CheesePizza: ", Pizza:isa(CheesePizza)) print("CheesePizza isa Tastable: ", CheesePizza:isa(Tastable)) print("CheesePizza isa Pizza: ", CheesePizza:isa(Pizza)) instance:taste() instance2:taste() For more information visit the Wiki. The code is also documented and a good guide, it is based on JavaDoc with a few noticeable differences. The actual code should be the final word on anything though and provides the most, it is under 300 lines total with at least half in comments (so more like 150 lines with comfort). Updates: November 13, 2015 Released version 0.3.1, Incorporated Class:implement into Class:extend Added filters to Mixin:hasa Allowed interface checking in Class:isa November 10, 2015 Released version 0.3.0. Link at top... Quote Link to post Share on other sites