{"id":16786449,"url":"https://github.com/nklbdev/simplest-ioc-container-lua","last_synced_at":"2025-03-16T23:23:20.730Z","repository":{"id":36131702,"uuid":"40435152","full_name":"nklbdev/simplest-ioc-container-lua","owner":"nklbdev","description":"Just simplest IoC container on Lua","archived":false,"fork":false,"pushed_at":"2018-10-23T13:12:02.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T09:33:11.130Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nklbdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-09T12:10:20.000Z","updated_at":"2018-10-23T13:12:04.000Z","dependencies_parsed_at":"2022-09-02T08:51:08.988Z","dependency_job_id":null,"html_url":"https://github.com/nklbdev/simplest-ioc-container-lua","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nklbdev%2Fsimplest-ioc-container-lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nklbdev%2Fsimplest-ioc-container-lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nklbdev%2Fsimplest-ioc-container-lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nklbdev%2Fsimplest-ioc-container-lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nklbdev","download_url":"https://codeload.github.com/nklbdev/simplest-ioc-container-lua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243945716,"owners_count":20372920,"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":[],"created_at":"2024-10-13T08:12:16.173Z","updated_at":"2025-03-16T23:23:20.708Z","avatar_url":"https://github.com/nklbdev.png","language":"Lua","readme":"# SimplestIocContainerLua\nJust simplest IoC container on Lua\n\nusage:\n```lua\nlocal SimplestIocContainer = require(\"simplest_ioc_container\")\n\nlocal container = SimplestIocContainer.new()\n\ncontainer:bind(\"a\", function(ctr)\n    return { b = ctr:resolve(\"b\"), c = ctr:resolve(\"c\"), d = \"asdfsdf\"}\nend, true)\n\ncontainer:bind(\"b\", function(ctr)\n    return \"BBBBBB\"\nend, true)\n\ncontainer:bind(\"c\", function(ctr)\n    return \"CCCCCCCC\"\nend, true)\n\nlocal a = container:resolve(\"a\")\nprint(a.b..\" \"..a.c..\" \"..a.d)\n```\nwill print:\nBBBBBB CCCCCCCC asdfsdf\n\nor in object-oriented manner:\n\n```lua\nlocal SimplestIocContainer = require(\"simplest_ioc_container\")\nlocal Thor = require(\"thor\")\nlocal Mjolnir = require(\"mjolnir\")\n\nlocal container = SimplestIocContainer.new()\n\ncontainer:bind(\"God\", function(ctr)\n    return Thor.new(ctr:resolve(\"Hammer\"))\nend, true)\n\ncontainer:bind(\"Hammer\", function(ctr)\n    return Mjolnir.new()\nend, true)\n\nlocal god = container:resolve(\"God\")\nprint(god.weapon.name)\n```\nYou can use any values as keys, for example, classes, as is implemented in other languages.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnklbdev%2Fsimplest-ioc-container-lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnklbdev%2Fsimplest-ioc-container-lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnklbdev%2Fsimplest-ioc-container-lua/lists"}