{"id":22335700,"url":"https://github.com/andrewmcwatters/lclass","last_synced_at":"2025-09-09T21:42:16.545Z","repository":{"id":5189339,"uuid":"6364088","full_name":"andrewmcwatters/lclass","owner":"andrewmcwatters","description":"Class-based object-oriented programming in Lua","archived":false,"fork":false,"pushed_at":"2024-02-14T22:19:19.000Z","size":40,"stargazers_count":73,"open_issues_count":0,"forks_count":3,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-11-26T10:30:21.270Z","etag":null,"topics":["class","lua"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"w3c/encrypted-media","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewmcwatters.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2012-10-24T03:33:45.000Z","updated_at":"2024-09-16T15:49:32.000Z","dependencies_parsed_at":"2024-02-14T23:27:43.784Z","dependency_job_id":"62b95a76-9763-4e0f-b124-a768c9e2285c","html_url":"https://github.com/andrewmcwatters/lclass","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmcwatters%2Flclass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmcwatters%2Flclass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmcwatters%2Flclass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewmcwatters%2Flclass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewmcwatters","download_url":"https://codeload.github.com/andrewmcwatters/lclass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228046858,"owners_count":17861109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["class","lua"],"created_at":"2024-12-04T05:14:45.753Z","updated_at":"2024-12-04T05:14:46.425Z","avatar_url":"https://github.com/andrewmcwatters.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lclass\nLua with Classes\n\n**lclass** has been in production environments for over a decade. It was\ndesigned specifically for use with PUC-Rio Lua 5.1 and LuaJIT and to be used\nalongside C++. It differs from all other known Lua class scripts in that classes\ncreated with it behave like classes bound and created with `luaL_register`.\n\nYou are encouraged to read class.lua to understand its features. It is only 155\nlines.\n\n## Usage\n### Creating a class\n```lua\nclass(\"amphibian\")\n```\n\n...or\n\n```lua\nclass \"amphibian\"\n```\n\n...or with inheritance\n\n```lua\n-- inherit from existing class \"animal\"\nclass \"amphibian\" (\"animal\")\n```\n\n### Creating a constructor\n```lua\nfunction amphibian:amphibian ()\n  -- call the base class constructor\n  animal.animal(self)\n  self.kingdom = \"Animalia\"\n  self.class   = \"Amphibia\"\nend\n```\n\n### Creating methods\n```lua\nfunction amphibian:swim ()\n  print(\"Splash!\")\nend\n```\n\n### Creating metamethods\n```lua\nfunction amphibian:__tostring ()\n  return \"amphibian: \" .. self.class\nend\n```\n\n### Creating an instance of a class\n```lua\nlocal a = amphibian()\n```\n\n### Creating a garbage-collection metamethod\n```lua\nfunction amphibian:amphibian ()\n  setproxy(self)\nend\n\nfunction amphibian:__gc()\n  -- ...\nend\n```\n\n## License\nMIT License\n\nCopyright (c) 2024 Andrew McWatters\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewmcwatters%2Flclass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewmcwatters%2Flclass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewmcwatters%2Flclass/lists"}