{"id":"bigfootpp/lucid","name":"lucid","scope":"bigfootpp","platform":"roblox","description":"A lightweight LuaU package to simplify OOP","version":"0.5.2","latest":"0.5.2","versions":["0.1.0","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4","0.3.0","0.4.0","0.5.0","0.5.1","0.5.2"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"890b0f50650ebf1ee289cf6637ba1628f8d9833d8f3a013b85cb1439c23020a1","likes":0,"downloads":0,"install":"forest install bigfootpp/lucid","url":"https://forest.dev/p/roblox/bigfootpp/lucid","files":"https://api.forest.dev/ai/package/roblox/bigfootpp/lucid/files","readme":"# LuCid\r\n\r\nLuCid is a **lightweight** Luau package designed to simplify Object-Oriented Programming (OOP) in Roblox.\r\n\r\n> [!WARNING]\r\n> This project is currently in **Beta**. Expect breaking changes and use with caution.\r\n\r\n## Installation\r\n\r\n### Wally\r\n\r\n```toml\r\nLuCid = \"bigfootpp/lucid@0.5.2\"\r\n```\r\n\r\n## Quick Start\r\n\r\n```lua\r\nlocal class = require(path.to.lucid)\r\n\r\nlocal Character = class() { Health = 100 } {\r\n    __init = function(self, name: string)\r\n        self.Name = name\r\n    end,\r\n\r\n    TakeDamage = function(self, amount: number)\r\n        self.Health = math.max(0, self.Health - amount)\r\n    end\r\n}\r\n\r\nlocal hero = Character:create(\"Explorer\")\r\nhero:TakeDamage(25)\r\n```\r\n\r\n## Inheritance\r\n\r\n```lua\r\nlocal Animal = class() { species = \"\" } {\r\n    speak = function(self)\r\n        return (\"The %s makes a sound\"):format(self.species)\r\n    end,\r\n}\r\n\r\nlocal Cat = class(Animal) { tail = true } {\r\n    speak = function(self)\r\n        return (\"The %s meows\"):format(self.species)\r\n    end,\r\n}\r\n```\r\n\r\n## super()\r\n\r\nCall a parent method from a child override:\r\n\r\n```lua\r\nlocal Base = class() { health = 100 } {\r\n    getHealth = function(self)\r\n        return self.health\r\n    end,\r\n}\r\n\r\nlocal Tank = class(Base) { armor = 50 } {\r\n    getHealth = function(self)\r\n        return self:super():getHealth() + self.armor\r\n    end,\r\n}\r\n```\r\n\r\nChained `super()` calls work across multiple levels:\r\n\r\n```lua\r\n-- A -> B -> C\r\n-- C:foo() calls super() -> B:foo() calls super() -> A:foo()\r\n```\r\n\r\n### Limitations\r\n\r\n- `super()` must be called **inside a class method**. Calling it directly in a `task.spawn` or `task.delay` callback will error.\r\n- A class method using `super()` **can** be called from `task.spawn` -- only bare `super()` calls outside of method dispatch are invalid.\r\n- `obj.method == obj.method` is `false` -- each access returns a new wrapper.\r\n\r\n## License\r\n\r\nMIT License. See `LICENSE`.\r\n","readmeTruncated":false}